Open Bug 1608701 Opened 5 years ago Updated 2 years ago

Creation of new WebSocket stalls for up to a minute in uncontrollable manner

Categories

(Core :: Networking: WebSockets, defect, P3)

72 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: anole3623, Unassigned)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

Attached image WebSocketsTimeout.png

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0

Steps to reproduce:

The js WebSocket client creates a new WebSocket to ws://localhost:8280 at WebSocket.onclose after a timeout of 1 second. There is no websocket server running at that location.

Place client.js (https://pastebin.com/NP7iWbEg) and client.html (https://pastebin.com/BzxDP3EZ) into a directory; then open client.html in Firefox. Open Network tab and then wait several minutes. Then, refresh the page shortly after the latest two connections are attempted. Next, close the tab and then make a new tab and navigate to client.html shortly after the latest two connections are attempted.

Actual results:

Firefox retries connection each nonconstant period, which eventually grows to 1 minute. More specifically, every other new WebSocket waits an extending amount of time before sending the websocket connection request. During this period of time Firefox is not sending any tcp messages to localhost:8280 as shown by running Wireshark.

Firefox only resets the timeout after an undetermined amount of time with the tab closed or by closing Firefox and opening it again.

Expected results:

Firefox indefinitely retries connection at least every second like Chromium. Clients should not have to wait up to a minute to reconnect to a websocket server after they have disconnected but now reconnected to the internet.

Component: Untriaged → Networking: WebSockets
Product: Firefox → Core
Priority: -- → P3
Whiteboard: [necko-triaged]

I think I may have encountered the same issue in a different way: instead of opening and closing WebSocket connections, I'm opening new tabs. Eventually it stalls for over a minute.

I put a test program here: https://gitlab.com/RockinRoel/ffwstest

(In reply to Roel Standaert from comment #1)

I think I may have encountered the same issue in a different way: instead of opening and closing WebSocket connections, I'm opening new tabs. Eventually it stalls for over a minute.

I put a test program here: https://gitlab.com/RockinRoel/ffwstest

Note: in my case there actually is a WebSocket server.

After further investigation, I noticed that my WS server wasn't properly doing the closing handshake.

I was opening many tabs, and then closing all of them. Because all of those connections were improperly closed, Firefox would immediately set the delay to the maximum of 1 minute.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: