Open Bug 1478314 Opened 6 years ago Updated 2 years ago

Websocket ssl connection can be very slow to connect in Firefox

Categories

(External Software Affecting Firefox :: Other, defect)

defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: terjepe, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36 Steps to reproduce: I have noticed that websocket ssl connections in Firefox can be seriously slow to open. It is pretty much instant in Chrome and Edge. Testcase: https://www.backgammonstudio.com/testconnect.html A perfectly normal WebSocket connection to: 'wss://www.backgammonstudio.com/_wsh_/' I am using letsencrypt on the server side. Actual results: In 62.0b10 (64-bit) I got: connecting: Wed Jul 25 2018 12:29:04 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:29:24 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:29:24 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:29:45 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:29:45 GMT+0200 (W. Europe Daylight Time) connected: Wed Jul 25 2018 12:29:45 GMT+0200 (W. Europe Daylight Time) In 60.0.2 (64-bits) I got: connecting: Wed Jul 25 2018 12:36:07 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:36:27 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:36:27 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:36:47 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:36:47 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:37:08 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:37:08 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:37:28 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:37:28 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:37:49 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:37:49 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:38:11 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:38:11 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:38:33 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:38:33 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:38:56 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:38:56 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:39:21 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:39:21 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:39:48 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:39:48 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:40:19 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:40:19 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:40:56 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:40:56 GMT+0200 (W. Europe Daylight Time) connected: Wed Jul 25 2018 12:41:21 GMT+0200 (W. Europe Daylight Time) Now that is bad. When grabbing the version number I noticed a new one 62.0b11 (64-bit): connecting: Wed Jul 25 2018 12:52:58 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:53:18 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:53:18 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:53:38 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:53:38 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:53:59 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:53:59 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 12:54:19 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 12:54:19 GMT+0200 (W. Europe Daylight Time) connected: Wed Jul 25 2018 12:54:20 GMT+0200 (W. Europe Daylight Time) Expected results: Same result as in Chrome/Edge which connects instantly: connecting: Wed Jul 25 2018 12:29:37 GMT+0200 (Central European Summer Time) connected: Wed Jul 25 2018 12:29:37 GMT+0200 (Central European Summer Time)
It turns out it is the F-secure Browsing protection which is causing this problem. When turned off it works fine. Why it would only affect Firefox and not the other browsers is a bit of a mystery though. Adding logging of the close event code I got: connecting: Wed Jul 25 2018 14:52:54 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 14:53:14 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 14:53:14 GMT+0200 (W. Europe Daylight Time) Close event code: 1006 connected: Wed Jul 25 2018 14:53:15 GMT+0200 (W. Europe Daylight Time)
Component: Networking: WebSockets → Other
Product: Core → External Software Affecting Firefox
Version: 62 Branch → unspecified
I may have been a bit too hasty in pointing the finger at F-secure as I have tried it a few times more and now F-secure (browsing protection) is disabled and it happened again: connecting: Wed Jul 25 2018 23:50:54 GMT+0200 (W. Europe Daylight Time) failed: Wed Jul 25 2018 23:51:14 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 23:51:14 GMT+0200 (W. Europe Daylight Time) Close event code: 1006 failed: Wed Jul 25 2018 23:51:35 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 23:51:35 GMT+0200 (W. Europe Daylight Time) Close event code: 1006 failed: Wed Jul 25 2018 23:51:55 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 23:51:55 GMT+0200 (W. Europe Daylight Time) Close event code: 1006 failed: Wed Jul 25 2018 23:52:16 GMT+0200 (W. Europe Daylight Time) connecting: Wed Jul 25 2018 23:52:16 GMT+0200 (W. Europe Daylight Time) Close event code: 1006 connected: Wed Jul 25 2018 23:52:21 GMT+0200 (W. Europe Daylight Time) While Firefox was failing to connect I tried the same in Chrome: connecting: Wed Jul 25 2018 23:51:26 GMT+0200 (Central European Summer Time) connected: Wed Jul 25 2018 23:51:26 GMT+0200 (Central European Summer Time) A couple of more tries and after what appeared to become another fail I reloaded and then Firefox connected right away: connecting: Wed Jul 25 2018 23:54:17 GMT+0200 (W. Europe Daylight Time) connected: Wed Jul 25 2018 23:54:17 GMT+0200 (W. Europe Daylight Time)
I tried the same testcase on a laptop and after a few tries I don't see any problems there so it looks like Firefox is off the hook (more or less..)! If it is F-secure or some other program that is intercepting internet traffic I can't say for sure though. You could argue that Firefox isn't able to shield its own traffic against interception than Chrome and Edge seems to be able to but that is a bit of speculation.
Severity: normal → S3

Struggeling with it for months, all versions of Firefox affected so far. Google Chrome has no problems.
Can some dev add an instruction how to debug that?

Worth to mention that when I start Firefox, wss can be connected immediately. However after few minutes it starts to be slower and slower. Nevertheless it connects eventuely, sometimes after a minute or more. I does for all tested FF versions, including nightly.
After that successful connection it can connect wss quite fast. But after few minutes it does the same as before.
The behaviour of testcase page above is the same to my server. Technical details: I use python's SimpleWebSocketServer as WS server behind nginx reverse proxy with Let's Encypt's SSL certificate.
The strange thing is that it worked fine somewhen before FF 105. Nothing changed on the server side meanwhile. It could be related to the user profile, because I have opened about 30+ tabs with many websockets, seems to be working fine on clean profile.

You need to log in before you can comment on or make changes to this bug.