Opened 3 months ago

Last modified 3 days ago

#31285 needs_review defect

Browsers accumulate permanently open UDP sockets over time

Reported by: cypherpunks Owned by: cohosh
Priority: Medium Milestone:
Component: Circumvention/Snowflake Version:
Severity: Normal Keywords: snowflake-webextension
Cc: arlolra, cohosh, phw, dcf Actual Points: .5
Parent ID: Points: 1
Reviewer: Sponsor:

Description

After running tests with both Firefox and Chrome for a couple of days (see ticket:31278), my Windows process status utility shows that both browsers have accumulated a bunch of open UDP sockets, proportional to the number of clients they've served so far. Once opened, the UDP sockets stay allocated by the browser's process until I close the corresponding static page tab or turn off the addon. So far, Firefox has created 64 sockets (32 each IPv4 & v6) while Chrome has only 14 (9 v4 & 5 v6) due to the Chrome client hanging bug reported earlier. Each time a new client is served, more sockets are created and never closed.

Not a problem normally, they're not a scarce resource, but if you leave a browser open for weeks or months at a time they'll really add up, especially once Snowflake gets more popular and the number of clients served per day increases.

Child Tickets

Change History (9)

comment:1 Changed 2 months ago by phw

Summary: Broswers accumulate permanently open UDP sockets over timeBrowsers accumulate permanently open UDP sockets over time

comment:2 Changed 2 months ago by cohosh

Points: 1

comment:3 Changed 7 weeks ago by dcf

In Firefox, go to about:networking#sockets and see if the open sockets are listed there. Is it clear what they are used for / related to? I suppose it can only be ICE related.

comment:4 Changed 4 weeks ago by cypherpunks

I checked, and none of them show up in that list. I assume they're not being opened by Firefox itself so it didn't log them, but were instead opened at a lower level inside some code that Firefox calls. Would Firefox be aware of what happens inside the ICE code or the addon? The persistent TCP connection to the Snowflake agent is listed though.

comment:5 Changed 3 days ago by cohosh

Confirmed that this was happening for me by running netstat -a -p -u | grep firefox

It looks like we weren't closing the peer connection in addition to the data channel. This patch fixes the behaviour for me: https://github.com/cohosh/snowflake/pull/11

comment:6 Changed 3 days ago by cohosh

Status: newneeds_review

comment:7 Changed 3 days ago by cohosh

Actual Points: .5
Owner: set to cohosh
Status: needs_reviewassigned

comment:8 Changed 3 days ago by cohosh

Status: assignedneeds_review

comment:9 in reply to:  3 Changed 3 days ago by cohosh

Replying to dcf:

In Firefox, go to about:networking#sockets and see if the open sockets are listed there. Is it clear what they are used for / related to? I suppose it can only be ICE related.

I think your intuition here was correct. Calling close() for the PeerConnection terminates ICE and releases these resources: https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/close

Note: See TracTickets for help on using tickets.