Skip to content
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

Fix undef internal call in supervisor2 #10305

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions deps/rabbit_common/src/supervisor2.erl
Original file line number Diff line number Diff line change
Expand Up @@ -878,17 +878,13 @@ do_restart_delay(Reason,

maybe_restart(Strategy, Child, State) ->
case restart(Strategy, Child, State) of
{{try_again, Reason}, NState2} ->
{{try_again, TryAgainId}, NState2} ->
%% Leaving control back to gen_server before
%% trying again. This way other incoming requests
%% for the supervisor can be handled - e.g. a
%% shutdown request for the supervisor or the
%% child.
Id = if ?is_simple(State) -> Child#child.pid;
true -> Child#child.id
end,
Args = [self(), Id, Reason],
{ok, _TRef} = timer:apply_after(0, ?MODULE, try_again_restart, Args),
Copy link
Contributor Author

@gomoripeti gomoripeti Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timer:apply_after with zero timeout executes the function immediatly but in a spawned process. However try_again_restart/1 only sends a gen_server cast so it should be fine to call it from the same process (same way as from restart/2)

try_again_restart(TryAgainId),
{ok, NState2};
Other ->
Other
Expand Down