-
Notifications
You must be signed in to change notification settings - Fork 29
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
Disconnect hangs #49
Comments
Furthermore, the line above does not seem to take the |
I do have test(s) for disconnect receipts, and do not see hangs. What stompngo version are you running ? Do you have a short example that shows this behavior ? Can you get me a stack trace of the hang (on Linux press Ctrl-\ when the hang occurs)? Can you enable logging and show me that output ? ReadDeadLine is reset between all calls to the TCP reader. They have to be. Otherwise nothing would work right. You could always request no receipt as a work around. |
Thank you very much for your prompt reply, much appreciated! stompngo version: v1.0.12 I'm currently working on a minimal example, I'll come back to you as soon as I know more or have it available. Please find the recorded stack trace with enabled connection logging attached: I enabled the logging with
Alright, I see. Thanks a lot for the information.
Unfortunately I have to request a receipt to make sure that the disconnection has worked properly, for reasons that are probably beyond the scope of this. Thank you very much for your help. If you have any questions/comments, please do not hesitate to say so. |
Are you fully draining your input queues/topics ? It looks like the system is deadlocked trying to send you a MESSAGE frame which you have not received. |
thanks a lot for your help. now I'm draining the topic in a parallel goroutine while disconnecting, and it doesn't hang anymore -- however, now, it never receives a receipt. |
short update: I see now that it works for some servers, for some not. I'll further investigate whether the error is in on the side of server's STOMP implementation, and come back to you if that error source is excluded. In the meantime I'll close this issue. |
By now I can say that the error is not on the side of the servers. |
The receipt is never deleted by stompngo code. Show me the logs you are looking at please. The receipt should actually be in the logs (see code in disconnect.go). Also ..... I need some code that recreates this. Because I cannot recreate it here ....... |
I've now taken another look at the logs and found something potentially interesting.
Contrary to my original suspicion, the logged receipt in this line is not the one in the received message (which is in fact empty, as logged) -- it is a second mentioning of the earlier sent receipt. c.log(DISCONNECT, "dr", ch, c.DisconnectReceipt) where I suggest to check in the library whether the received receipt is the valid & expected one, e.g. with conn.DisconnectReceipt.Message.Headers.ContainsKV(stomp.HK_RECEIPT_ID, receipt) and with listening to the receipt with some safety margin. For example, one can start listening already right before sending the I've implemented this mentioned procedure, let me know if you'd like me to contribute the code. Also, I'm working on a small example, I'll come back to you as soon as I know more. |
I'd like to give a short progress update. Since I have no idea where the issue comes from, and since the hypothetical race condition seems nontrivial to debug, I've now chosen the following procedure (and will change it back as soon as this issue is solved): If I don't get a receipt, it's not too bad, since I close the underlying connection afterwards anyways. So, I attempt to do it the nice way -- with a receipt -- but if it doesn't work, the program doesn't throw an error, it just warns, closes the underlying connection, and exits, since this is anyway the last action (at least in the current implementation). If you'd like to suggest a different procedure or would recommend a different approach, please feel free to let me know, I'd be happy hear your feedback. |
Put a check in your code that looks at what is actually in conn.DisconnectReceipt. I want to know if it is actually an ERROR frame. That is entirely possible, and my code does not handle that properly. I am working on a fix for that. |
Ah, I think there might be a small misunderstanding :) I did not receive ERROR frames, but entirely empty ones; I have checks for this in the code: if r.Message.Command == "" && (len(r.Message.Headers) == 0) && (len(r.Message.Body) == 0) {
emptyMsgCount += 1
} In general , thanks a lot for looking into this, much appreciated! |
Two items:
https://stomp.github.io/stomp-specification-1.2.html#Connection_Lingering Read the last sentence of that section. |
Sorry for the delayed message. |
Note that there is another reference to this behavior in: https://stomp.github.io/stomp-specification-1.2.html#DISCONNECT Question: have you tried this with heartbeats on? |
Indeed, this is very helpful! Thanks a lot, your help is much appreciated. |
There is another enhancement to DISCONNECT on the dev branch. It allows the user to optionally specify a "disconnect timeout". After the timeout expires, if no RECEIPT frame has been received, DISCONNECT will return an error indicating a timeout. |
Also, I pushed v1.0.13 to github a bit ago. Includes all the DISCONNECT enhancements. Please give that a try. |
Please excuse the delayed reply. case <- time.After(<timeout>) instead of creating a |
I am always curious about brokers. I would like to ask: from AMQ to what ? Here I test with:
Using time.After is a good idea, thanks, I will probably tweak the code to do that. |
I switched from AMQ to a totally different approach that doesn't involve messaging at all -- not because of the messaging itself, but because my program needs to fetch information from somewhere else after all. :) You're welcome, as already said just a small suggestion, nothing important. Thank you very much for helping with this, very much appreciated! And in general thank you very much for maintaining this library. |
Apologies for the very tardy reply. Removal of TIcker form that code has been on DEV since 12/23/19. Commit: I hope you have been able to try that. I am going to close this issue based on the above. If you need to re-open it, please d so. Regards, Guy |
Thanks much for your message :) no worries about the delay. |
Hello,
Thanks a lot for developing this nice tool.
I've got a question regarding the connection
Disconnect
function; when I use it, it hangs, and when I debug it, the debugger stops at the following line:stompngo/disconnect.go
Line 83 in 78e25a2
Do you have any ideas why this might be the case?
Thanks a lot for your help in advance.
Feel free to let me know if you need any further information.
The text was updated successfully, but these errors were encountered: