Skip to content

Commit

Permalink
Avoid deadlock on terminating ff controller
Browse files Browse the repository at this point in the history
If the global process is itself, it means it just crashed.
It shouldn't wait but terminate
  • Loading branch information
dcorbacho committed Jun 13, 2024
1 parent 0875169 commit 334883b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deps/rabbit/src/rabbit_ff_controller.erl
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,14 @@ terminate(_Reason, _State, _Data) ->
ok.

wait_for_in_flight_operations() ->
case global:whereis_name(?GLOBAL_NAME) of
Pid when Pid == self() ->
ok;
_ ->
wait_for_in_flight_operations0()
end.

wait_for_in_flight_operations0() ->
case register_globally() of
yes ->
%% We don't unregister so the controller holds the lock until it
Expand Down

0 comments on commit 334883b

Please sign in to comment.