WebSocket becomes unresponsive after 24 to 48 hours, no exception occurs.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.1k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
My app uses websocket-sharp for a Slack bot that is "always on". It works well, but after about 24 to 48 hours, the bot just stops responding. I have try/catch blocks on each of the WebSocket event handlers (OnError, OnMessage, etc.), that log all Exceptions. However, when the app goes into it's "zombie" state, I don't see any error messages in the log. I have the app currently running in the Visual Studio 2013 IDE, and there are not errors in the Output window either.
If I try to disconnect (close the socket) from the app when it's in this state, I get the following error:
/2/2016 9:16:28 AM|Fatal|<>c__DisplayClass17.b__16:1711|System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
--- End of inner exception stack trace ---
at System.Net.Security._SslStream.EndRead(IAsyncResult asyncResult)
at System.Net.Security.SslStream.EndRead(IAsyncResult asyncResult)
at WebSocketSharp.Ext.<>c__DisplayClass9.b__8(IAsyncResult ar) in c:\Visual Studio 2012\Projects\Windows Forms\WebSocketSharp\websocket-sharp\Ext.cs:line 648
At this point I have to restart the app.
Is there some kind of a proactive operation I can do on my end to check if the WebSocket is actually functional or not? Something I could put in an async loop?
Also, is there a way to reinitialize the base websocket-sharp library in case the problem is some kind of a corruption deep within the library? I'd prefer not to have to have the app self-close and restart when this happens.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the receive path referenced in Ext.cs:line 648 and the WebSocket event handlers described in the report. Reproduce the long-running connection failure and determine whether the socket can be detected or reinitialized without restarting the application; done means the failure and recovery behavior are covered by a clear, repeatable result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100