Bug 57750 - WebSocket does not get closed when network is disconnected
Summary: WebSocket does not get closed when network is disconnected
Status: RESOLVED DUPLICATE of bug 57546
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.50
Hardware: PC Linux
: P2 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2015-03-24 11:44 UTC by roman.stobnicki
Modified: 2015-04-01 12:34 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description roman.stobnicki 2015-03-24 11:44:04 UTC
We created a WebSocket between a browser (Chrome) and Mobicents ApacheTomcat Application Server. When network gets disconnected we expected to for our onClose() method to be called at some point now that the connection has been compromised. In the meantime we are going to implement ping-pong type of messaging but since WebSocket rides on TCP and it has its keep alive mechanism already there should be no need to do anything outside of it. Please advise and let me know if you need any additional information.
Comment 1 Mark Thomas 2015-03-24 12:43:35 UTC
Which WebSocket implementation?
Which connector?

Depending on circumstances, Tomcat may not be informed of the network disconnection - in which case there is no way for Tomcat to call onClose().
Comment 2 Christopher Schultz 2015-03-24 19:28:15 UTC
I seem to recall markt doing some work on this recently: you (Mark) weren't able to replicate a network drop by disconnecting your VMs network, but physically pulling the Ethernet cable from your laptop seemed to do the trick.

Could this have been fixed /post/ 7.0.50?
Comment 3 Mark Thomas 2015-03-24 22:27:32 UTC
Thanks Chris. I hadn't joined up those dots.

*** This bug has been marked as a duplicate of bug 57546 ***
Comment 4 Christopher Schultz 2015-03-25 17:57:30 UTC
(In reply to Mark Thomas from comment #3)
> Thanks Chris. I hadn't joined up those dots.
> *** This bug has been marked as a duplicate of bug 57546 ***

FTR, bug #57546 was fixed in 7.0.59. Please upgrade and re-test.
Comment 5 roman.stobnicki 2015-04-01 12:34:59 UTC
Sorry for late replay but update emails were caught in my spam :-)

Just wanted to add that actually we did many tests and found out that TCP keep alive timers are only good between the "hops" and not end to end. So, implementing some sort of Ping/Pong mechanism one level higher seems to be the only way to verify if the two ends can still talk to each other or not.

The test: I have connected a Chrome client running on a laptop and called into my conferencing application running on ApacheTomcat. When connection was established after about 40 seconds I disconnected the network on the laptop and noticed that websocket was not notified that it was closed. If I attempted to send something to it at that moment then it will tell me that websocket no longer exists. Changing TCP keepalive timers on AS I could see them going back and forth from AS out and back... but did not see them on the client machine at all. That is what made me believe that these timer settings are only between the network hops.