-
Notifications
You must be signed in to change notification settings - Fork 143
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
RequestAsync doesn't resume after broker restart (2.x) #272
Comments
Hello, hi! No worries - the issues you raise are relevant for the client, so don't stop 👍 Is your scenario that the broker goes down after a request is sent, before the response is received? And does this occur when a RPC call of the same message types have been successfully performed? |
It's after an RPC call of the same message type has been successfully performed (both sent and received) |
I took a look at this, and it turns out that the issue was mitigated in the consumer factory in a recent commit ( I tried to reproduce the issue you described by:
Doing this with the current code in branch 2.0 executed as expected. |
I still have the same issue. Slightly different steps to reproduce:
The call to |
This fix was originally intended for RPC calls not returning response if the broker goes down before the response is sent. However, the issue is that in case of broker goes down and then recovers we need to assure two things: 1. wait until the recovery has taken place 2. sanity check if the channel has been reset, and if so do not ack
I've got some good news and some bad news 😉 The good news is that I've identified the problem. It was also related to the publish sequence that was being reset when the broker was restarted. RawRabbit didn't check to see if the delivery tag made sense for the channel, and could try to ack on a delivery tag that the broker did not recognize. With a fix for this in place I was able to restart the broker mid-RPC and get the response. The bad news is that it does seem to wrok with direct RPC (which is what RawRabbit uses by default). I don't know if the "pseudo queue" used for response is configured with auto-delete (and thus removed when the consumer disconnects). Here's an example of how the request was configured when I got it to work: await requester.RequestAsync<BasicRequest, BasicResponse>(new BasicRequest(), ctx => ctx
.UseRequestConfiguration(cfg => cfg
.ConsumeResponse(r => r
.Consume(c => c
.WithRoutingKey("response_key"))
.FromDeclaredQueue(q => q
.WithName("response_queue"))
.OnDeclaredExchange(e => e
.WithName("response_exchange")
)
)
), ct: cs.Token); Two things to note:
|
Thanks for looking into this, I'll give it a try tomorrow! Regarding a cancellation token, yes, I think what I'll do is use one to timeout requests after a while, then retry. That way, even if the request hangs while the broker is down, it will timeout eventually regardless. |
Excellent, the config you provided works as described! |
Sorry, another issue relating to the broker going down!
Using RawRabbit 2.x with request/response, I have an
IBusClient
that callsRequestAsync
. When the broker goes down after at least one request has already been sent, I see these messages logged from RawRabbit:When the broker comes back up, I see:
...which sounds very promising, but actually the call to
RequestAsync
appears hung, as it never returns.The text was updated successfully, but these errors were encountered: