-
Notifications
You must be signed in to change notification settings - Fork 142
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
the publishWithContext interface will not return when it times out #178
Comments
This happens because rabbitmq stops reading from the connection socket when there's a memory alarm; therefore, the I/O call to write the publish frame to the socket never returns. Unfortunately, the io.Writer does not provide a way to pass down the context. In summary, if the library is waiting on a blocking I/O operation, the context cancellation is ignored. The same applies to We could add an extension to the protocol, and provide |
Missed heartbeats should eventually close the connection, right? |
I don't think so, for the same reason as above. The heartbeater will try to write to the socket, and it will be blocked on I/O Lines 707 to 710 in 190c143
The problem is the Line 429 in 190c143
I have an idea to set a deadline on the heartbeater I/O calls, to address this situation, but that can break other things in some obscure, hard to diagnose, ways. @liuxiaomeiG it would be super helpful if you could dump the stack trace of all go routines in your program when this situation happens. This post gives some guidance to do this: |
It looks like we don't continue to set any deadlines after the connection is initialized. My understanding (after reading the docs briefly) is that prior to each write a deadline should be set for the write to complete. If the deadline passes, the blocking operation will throw an exception. |
Indeed we don't set deadlines. It's a but tricky to do because a connection can have multiple channels, and if we set deadlines on each I/O operation on every channel, deadlines will overlap, because the deadline is set in the TCP connection i.e. in the |
hey everyone 👋 I have a test to reproduce this issue. However, I was slightly wrong about the heartbeater. Even when the connection is blocked (because memory alarm), the heartbeater keeps sending and receiving heartbeats. I verified that heartbeats keep flowing via WireShark and a network traffic capture. The problem is that I'd like to verify what happens in other clients, so that we take a consistent solution across our client implementations. |
I'm pretty sure in this case the .NET client will throw on operation timeout exception. |
The Java client also provides a timeout mechanism. This is going to be a bit tricky to do in this client, because |
@liuxiaomeiG we introduced a new function Regarding |
When there is a memory alarm in the rabbit, the publishWithContext interface will not return when it times out, and will be stuck all the time. In addition, you cannot manually close the channel and connection at this time
The text was updated successfully, but these errors were encountered: