25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

Don't crash on most common gen_server:call errors

This commit is contained in:
Evgeniy Khramtsov 2018-07-01 14:26:49 +03:00
parent b662ec2a78
commit 6b8bc811ac
2 changed files with 9 additions and 2 deletions

View File

@ -580,8 +580,13 @@ sql_query_internal(#sql_query{} = Query) ->
sqlite ->
sqlite_sql_query(Query)
end
catch
Class:Reason ->
catch exit:{timeout, _} ->
{error, <<"timed out">>};
exit:{killed, _} ->
{error, <<"killed">>};
exit:{normal, _} ->
{error, <<"terminated unexpectedly">>};
Class:Reason ->
ST = erlang:get_stacktrace(),
?ERROR_MSG("Internal error while processing SQL query: ~p",
[{Class, Reason, ST}]),

View File

@ -682,6 +682,8 @@ inherit_session_state(#{user := U, server := S,
{error, <<"Previous session PID is dead">>};
exit:{normal, _} ->
{error, <<"Previous session PID has exited">>};
exit:{killed, _} ->
{error, <<"Previous session PID has been killed">>};
exit:{timeout, _} ->
ejabberd_sm:close_session(OldSID, U, S, R),
ejabberd_c2s:stop(OldPID),