-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix crash when consuming from unavailable quorum queue #13625
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
Conversation
| condition = ?V_1_0_AMQP_ERROR_INTERNAL_ERROR, | ||
| description = {utf8, Desc}}}}} -> | ||
| ?assertEqual( | ||
| <<"failed consuming from quorum queue 'q-down' in vhost '/': noproc">>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we replace the "noproc" with something like "the leader replica was unavailable or not elected"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally yes. However, noproc is an exit reason returned from https://www.erlang.org/doc/apps/stdlib/gen_statem.html#call/3. That function can return other exit reasons too. I'd like to avoid parsing and translating any possible exit reason from gen_statem:call/3. The alternative would be to log this Erlang term only in the server and not pass it down to the client app.
FWIW, I removed the noproc from the test expectation.
Prior to this commit, when a client consumed from an unavailable quorum
queue, the following crash occurred:
```
{badmatch,{error,noproc}}
[{rabbit_quorum_queue,consume,3,[{file,\"rabbit_quorum_queue.erl\"},{line,993}]}
```
This commit fixes this bug by returning any error when registering a
quorum queue consumer to rabbit_queue_type.
This commit also refactors errors returned by
rabbit_queue_type:consume/3 to simplify and ensure seperation of
concerns.
For example prior to this commit, the channel did error
formatting specifically for consuming from streams. It's better if
the channel is unaware of what queue type it consumes from and have each
queue type implementation format their own errors.
kjnilsson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Just a bit of formatting feedback.
#13625 (comment) #13625 (comment) (cherry picked from commit c151806)
#13625 (comment) #13625 (comment) (cherry picked from commit c151806)
Prior to this commit, when a client consumed from an unavailable quorum queue, the following crash occurred:
This commit fixes this bug by returning any error when registering a quorum queue consumer to rabbit_queue_type.
This commit also refactors errors returned by
rabbit_queue_type:consume/3 to simplify and ensure seperation of concerns.
For example prior to this commit, the channel did error formatting specifically for consuming from streams. It's better if the channel is unaware of what queue type it consumes from and have each queue type implementation format their own errors.
Jira: RMQ-1582