25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +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.
wait_for_process(Process) ->
MonitorReference = erlang:monitor(process, Process),
wait_for_stop(Process, MonitorReference).
try erlang:monitor(process, Process) of
MonitorReference ->
wait_for_stop(Process, MonitorReference)
catch
_:_ ->
ok
end.
wait_for_stop(Process, MonitorReference) ->
receive