-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential panic when OrderMatters = false
and connection lost whilst handler in progress
#505
Comments
OrderMatters = false
and connection lost whils handler in progressOrderMatters = false
and connection lost whilst handler in progress
… whilst handler running. Ref Issue eclipse#505
I have created a PR that tests for, and should resolve, this issue; would appreciate any comments on this (not all that happy with the way this works but think it will reliably solve the issue without breaking anyone's code). Will leave this as a PR for a week in case someone has time to review. |
Resolve send on closed channel when order=false and connection closed. Ref issue #505
As there was no feedback I have gone ahead and merged the PR; would appreciate confirmation that @master resolves this issue and does not introduce any further problems. |
Closing as v1.3.5 is now out with the fix. |
From PR #504 - logging here so this is more visible (note that the PR will not be accepted as it stands because it sends the ACK before the handler terminates).
When
OrderMatters = false
there is a potential panic due to this line (panic will occur here or here); in summary the sequence of events is:Disconnect
called),internalConnLost
callsc.stopCommsWorkers()
which (via a chain) results in the closure ofackChan
ackFunc(ackChan, client.persist, message
is called which attempts to send to the closedackChan
resulting in a panic.I made major changes for @1.3.0 to try and remove a range of potential deadlocks and will have introduced this issue at that point (@1.2 did not close incomingPubChan which was not really ideal either as it will have left hanging goRoutines). From the comment
I can see that I spotted the risk but missed the fact that matchAndDispatch is doing exactly what I was warning about! At the time usage of
OrderMatters = false
was fairly low so most tests do not set this option; I have encouraged the use of this option since due to the number of issues logged that turn out to be caused by long running message handlers blocking keep alives.I think the only viable solution is going to be to drop ACK calls if the connection has been lost but note that it is important that
matchAndDispatch
shuts down cleanly/quickly even if handlers are still running.The text was updated successfully, but these errors were encountered: