-
Notifications
You must be signed in to change notification settings - Fork 10
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
osiris_replica_reader: Stop with normal
if the leader is already gone during init/1
#162
Merged
kjnilsson
merged 1 commit into
main
from
handle-premature-leader-exit-in-osiris_replica_reader
Jun 24, 2024
Merged
osiris_replica_reader: Stop with normal
if the leader is already gone during init/1
#162
kjnilsson
merged 1 commit into
main
from
handle-premature-leader-exit-in-osiris_replica_reader
Jun 24, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
michaelklishin
approved these changes
May 22, 2024
dumbbell
force-pushed
the
handle-premature-leader-exit-in-osiris_replica_reader
branch
from
May 23, 2024 07:53
4f0489e
to
5c3c10d
Compare
kjnilsson
reviewed
Jun 24, 2024
kjnilsson
requested changes
Jun 24, 2024
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.
formatting
…ne during `init/1` [Why] In the context of RabbitMQ, if a stream queue is deleted right after being declared, there is a chance that some Osiris processes might not be ready yet at the time the queue is deleted. In particular, the `osiris_replica_reader` process monitors the given leader (an `osiris_writer` process in the context of a RabbitMQ stream queue) during its `init/1` and that process might be stopped already. When this happens, here is the crash that is logged: [error] <0.1548.0> ** Generic server <0.1548.0> terminating [error] <0.1548.0> ** Last message in was {'DOWN',#Ref<0.1118981177.1281884162.97904>,process, [error] <0.1548.0> <0.1535.0>,noproc} [error] <0.1548.0> ** When Server state == {state, [error] <0.1548.0> {osiris_log, [error] <0.1548.0> {cfg, [error] <0.1548.0> ".../__delete_queue_1716383944197847531", [error] <0.1548.0> <<"__delete_queue_1716383944197847531">>,500000000, [error] <0.1548.0> 256000,#{},[], [error] <0.1548.0> {write_concurrency, [error] <0.1548.0> #Ref<0.1118981177.1282015234.97903>}, [error] <0.1548.0> {osiris_replica_reader, [error] <0.1548.0> {resource,<<"/">>,queue,<<"delete_queue">>}, [error] <0.1548.0> {127,0,0,1}, [error] <0.1548.0> 6489}, [error] <0.1548.0> #Fun<osiris_writer.0.78287785>, [error] <0.1548.0> #Ref<0.1118981177.1282015234.97826>,16}, [error] <0.1548.0> {read,data,0,tcp,all,8,undefined}, [error] <0.1548.0> undefined,undefined, [error] <0.1548.0> {file_descriptor,prim_file, [error] <0.1548.0> #{handle => #Ref<0.1118981177.1282015238.91045>, [error] <0.1548.0> owner => <0.1548.0>, [error] <0.1548.0> r_buffer => #Ref<0.1118981177.1282015234.97902>, [error] <0.1548.0> r_ahead_size => 0}}}, [error] <0.1548.0> <<"__delete_queue_1716383944197847531">>,tcp, [error] <0.1548.0> #Port<0.84>,<33363.1916.0>,<0.1535.0>, [error] <0.1548.0> #Ref<0.1118981177.1281884162.97904>, [error] <0.1548.0> {write_concurrency, [error] <0.1548.0> #Ref<0.1118981177.1282015234.97903>}, [error] <0.1548.0> {osiris_replica_reader, [error] <0.1548.0> {resource,<<"/">>,queue,<<"delete_queue">>}, [error] <0.1548.0> {127,0,0,1}, [error] <0.1548.0> 6489}, [error] <0.1548.0> -1,0} [error] <0.1548.0> ** Reason for termination == [error] <0.1548.0> ** noproc That is because the `osiris_replica_reader` process receives the `DOWN` message from the leader monitoring with the `noproc` reason. It reuses the reason for its own exit reason. Because this is an abnormal reason, a crash is being logged. [How] There is no reason to log such a crash when the process tree is being shut down concurrently. `osiris_replica_reader` can terminate with a `normal` reason. That is what this patch does: if the leader exit reason is `noproc`, it terminates with the `normal` reason instead.
dumbbell
force-pushed
the
handle-premature-leader-exit-in-osiris_replica_reader
branch
from
June 24, 2024 14:27
5c3c10d
to
8a4ec95
Compare
kjnilsson
deleted the
handle-premature-leader-exit-in-osiris_replica_reader
branch
June 24, 2024 14:37
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
In the context of RabbitMQ, if a stream queue is deleted right after being declared, there is a chance that some Osiris processes might not be ready yet at the time the queue is deleted.
In particular, the
osiris_replica_reader
process monitors the given leader (anosiris_writer
process in the context of a RabbitMQ stream queue) during itsinit/1
and that process might be stopped already.When this happens, here is the crash that is logged:
That is because the
osiris_replica_reader
process receives theDOWN
message from the leader monitoring with thenoproc
reason. It reuses the reason for its own exit reason. Because this is an abnormal reason, a crash is being logged.How
There is no reason to log such a crash when the process tree is being shut down concurrently.
osiris_replica_reader
can terminate with anormal
reason.That is what this patch does: if the leader exit reason is
noproc
, it terminates with thenormal
reason instead.