From 473e600b531cd90978dbc9f2019988d08663f37b Mon Sep 17 00:00:00 2001 From: JianBo He Date: Fri, 13 Aug 2021 16:41:16 +0800 Subject: [PATCH] fix(exproto): fix badarg is_process_alive/1 --- apps/emqx_exproto/src/emqx_exproto_gsvr.erl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/emqx_exproto/src/emqx_exproto_gsvr.erl b/apps/emqx_exproto/src/emqx_exproto_gsvr.erl index a4ad5b2e4..bc4abfc4d 100644 --- a/apps/emqx_exproto/src/emqx_exproto_gsvr.erl +++ b/apps/emqx_exproto/src/emqx_exproto_gsvr.erl @@ -123,12 +123,14 @@ call(ConnStr, Req) -> {error, ?RESP_PARAMS_TYPE_ERROR, <<"The conn type error">>}; Pid when is_pid(Pid) -> - case erlang:is_process_alive(Pid) of - true -> - emqx_exproto_conn:call(Pid, Req); - false -> + case catch emqx_exproto_conn:call(Pid, Req) of + {'EXIT',{noproc, _}} -> {error, ?RESP_CONN_PROCESS_NOT_ALIVE, - <<"Connection process is not alive">>} + <<"Connection process is not alive">>}; + {'EXIT',{timeout, _}} -> + {error, ?RESP_UNKNOWN, <<"Connection is not answered">>}; + Result -> + Result end end.