Closed Bug 788913 Opened 14 years ago Closed 12 years ago

Firefox not closing timed out websocket

Categories

(Core :: Networking: WebSockets, defect)

15 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 983243

People

(Reporter: matsondawson, Assigned: jduell.mcbugs)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20100101 Firefox/15.0 Build ID: 20120824154833 Steps to reproduce: The test scenario involves a connection to Tomcat websockets. Tomcat websocket hangs on send because Firefox has timed out the socket but not closed it. Firefox: 15.0 Tomcat: 7.0.29 OS: Windows XP Reproduce: In a websocket chat application with Firefox... Place a breakpoint in your websocket servlet such that firefox times out on websocket connect (usually about 20 seconds). Once Firefox times out continue from your breakpoint, connection is stored in chat application. Attempt to write to socket from tomcat, socket hangs. Expected: Socket should be closed and thus fail in Tomcat, socket is actually still open but not responding. Original bug was raised on Tomcat under: https://issues.apache.org/bugzilla/show ... i?id=53829 Response to bug was: Firefox doesn't close the connection, so since WebSocket uses an infinite timeout by default, Tomcat just sits and waits for Firefox so send some data. As soon as I close Firefox, the thread is released. You may also want to report a bug against Firefox since the onClose() event is firing but the socket is remaining open. Wireshark Logs: GET /ui/websocket/hearing/hearing/1200104 HTTP/1.1 Host: moj117894:8080 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20100101 Firefox/15.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive, Upgrade Sec-WebSocket-Version: 13 Origin: http://moj117894:8080 Sec-WebSocket-Key: UIyLw0/EsRG+7TDfxfQmTg== Cookie: JSESSIONID=A4679E88661013FF6373678295570C30 Pragma: no-cache Cache-Control: no-cache Upgrade: websocket HTTP/1.1 101 Switching Protocols Server: Apache-Coyote/1.1 Upgrade: websocket Connection: upgrade Sec-WebSocket-Accept: TnY3IjeHT7nLI19/uac9E07VEjM= Transfer-Encoding: chunked Date: Thu, 06 Sep 2012 02:06:23 GMT 1 0.000000 10.134.2.121 10.134.2.160 TCP 62 4944 > http-alt [SYN] Seq=0 Win=65535 Len=0 MSS=1460 SACK_PERM=1 2 0.000027 10.134.2.160 10.134.2.121 TCP 62 http-alt > 4944 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1460 SACK_PERM=1 3 0.000324 10.134.2.121 10.134.2.160 TCP 60 4944 > http-alt [ACK] Seq=1 Ack=1 Win=65535 Len=0 4 0.000391 10.134.2.121 10.134.2.160 HTTP 599 GET /ui/websocket/hearing/hearing/1200104 HTTP/1.1 5 0.227215 10.134.2.160 10.134.2.121 TCP 54 http-alt > 4944 [ACK] Seq=1 Ack=546 Win=64990 Len=0 6 27.648327 10.134.2.160 10.134.2.121 TCP 275 [TCP segment of a reassembled PDU] 7 27.749433 10.134.2.121 10.134.2.160 TCP 60 4944 > http-alt [ACK] Seq=546 Ack=222 Win=65314 Len=0 Actual results: Socket hangs as firefox retains it as open, but does not respond. Expected results: Socket should have closed.
Component: Untriaged → Networking: WebSockets
Product: Firefox → Core
Attached patch WIP v1 — — Splinter Review
@matsondawson: can you tell me exactly when the breakpoint pause is getting hit? I.e where in the wireshark log does it happen? I'm not clear where the pause happens on our end. Patrick--looks like nsHttpChannel::OnStopRequest calls CompleteUpgrade() and hands the socket over to WebSocketChannel, which then doesn't check OnStopRequest status to see if the connection status failed. But I'm not clear on how the timeout here is happening on our end, or if this is the right approach for a fix (might make more sense not to upgrade if we already know status is bad?).
Attachment #659307 - Flags: feedback?(mcmanus)
The second column in the wireshark log is the time. The debug breakpoint is hit at the 5th log entry.
Comment on attachment 659307 [details] [diff] [review] WIP v1 I'm fine with this patch - I think its a missing bit. but I suspect it won't help the problem at hand.. OP says "20 seconds" which in this case probably means mOpenTimer is expiring.. that timer gets cleared when ::OnStartRequest() is called for the boot strap handshake. so to reproduce without a breakpoint, I bet you could just hardcode that timeout to 1 ms and see if the server process sees a closed socket or not.. (the pref forces at least 1 full second, so you can't just set that).
Attachment #659307 - Flags: feedback?(mcmanus)
Assignee: nobody → jduell.mcbugs
I think Bug 983243 should have probably fixed this use case as well. Marking as duplicate.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: