25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Catch potential exceptions in gen_mod:wait_for_process

Seems that at ejabberd shutdown, process may terminate before that function
is called, and in that case erlang:monitor throws exception.
This commit is contained in:
Paweł Chmielowski 2019-04-24 13:46:09 +02:00
parent fc043dd8cf
commit 8b501f5fe6

View File

@ -364,8 +364,13 @@ stop_module_keep_config(Host, Module) ->
end. end.
wait_for_process(Process) -> wait_for_process(Process) ->
MonitorReference = erlang:monitor(process, Process), try erlang:monitor(process, Process) of
wait_for_stop(Process, MonitorReference). MonitorReference ->
wait_for_stop(Process, MonitorReference)
catch
_:_ ->
ok
end.
wait_for_stop(Process, MonitorReference) -> wait_for_stop(Process, MonitorReference) ->
receive receive