Data stream stops, cannot close connection. Possible deadlock? #10
Comments
Thanks for the extremely detailed bug report! I really appreciate it. I'm quite busy at the moment, but if I get a chance to investigate this in the next few weeks, I will. I think you might be onto something with that |
I tried to trace the code flow that might lead to this bug. Here's what I found:
So potentially, the third step might be spawing 5 instances of the following a
This means that in the worst case scenario, this could take 43.75 minutes (25 * I still have to add some more tests since new code paths have been added, but |
This should be fixed in master as of v0.3.3 (7289a89). If the issue is not fixed for you, please feel free to comment and I'll re-open. |
I'm following your Bittrex example and I've noticed that after a random period of time (usually 5+ hours), my signalr client's
MsgHandler()
function will stop receiving data.I coded in a workaround which monitors the amount of data coming through my system, and if I stop getting data, I'll run the
Close()
function on my existing connection, then I'll build a new one and start over.When testing, this works perfectly fine. However my tests don't actually reproduce the issue of data not being pushed through the stream. When I run my workaround in production when the issue occurs, the
Close()
function ends up hanging indefinitely, and I'm never able to build a new connection. This leads me to believe that there is a deadlock somewhere in this package.Since the
Close()
function just pushes an item into a channel (https://github.com/carterjones/signalr/blob/master/signalr.go#L671), and that channel is only read from in thereadMessage()
function (https://github.com/carterjones/signalr/blob/master/signalr.go#L551), I think that I'm hitting a deadlock inreadMessage()
which is preventing my connection from being closed. Also - it's likely the source of my error in the first place.Apologies if the above is too vague, but I wanted to at least drop an initial report here to see if you had any thoughts. My next step is going to be to dig into this package a big deeper and try to debug.
The text was updated successfully, but these errors were encountered: