From 42af1f9d634b1408f537c233a7d1fe9801e7950b Mon Sep 17 00:00:00 2001 From: Serge Tupchii Date: Fri, 29 Mar 2024 13:29:19 +0200 Subject: [PATCH] fix: handle internal timeout errors in client Mqueue/Inflight APIs --- apps/emqx_management/src/emqx_mgmt.erl | 14 +++++++++++++- apps/emqx_management/src/emqx_mgmt_api_clients.erl | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/emqx_management/src/emqx_mgmt.erl b/apps/emqx_management/src/emqx_mgmt.erl index df0450395..bc194f03e 100644 --- a/apps/emqx_management/src/emqx_mgmt.erl +++ b/apps/emqx_management/src/emqx_mgmt.erl @@ -713,5 +713,17 @@ call_conn(ConnMod, Pid, Req) -> exit:{R, _} when R =:= shutdown; R =:= noproc -> {error, shutdown}; exit:{{shutdown, _OOMInfo}, _Location} -> - {error, shutdown} + {error, shutdown}; + exit:timeout -> + ?SLOG( + warning, + #{ + msg => "call_client_connection_process_timeout", + request => Req, + pid => Pid, + module => ConnMod, + stacktrace => erlang:process_info(Pid, current_stacktrace) + } + ), + {error, timeout} end. diff --git a/apps/emqx_management/src/emqx_mgmt_api_clients.erl b/apps/emqx_management/src/emqx_mgmt_api_clients.erl index dd65c1245..262faf87f 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_clients.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_clients.erl @@ -1232,6 +1232,8 @@ list_client_msgs(MsgType, ClientID, QString) -> code => 'NOT_IMPLEMENTED', message => <<"API not implemented for persistent sessions">> }}; + {error, Reason} -> + ?INTERNAL_ERROR(Reason); {Msgs, Meta = #{}} when is_list(Msgs) -> format_msgs_resp(MsgType, Msgs, Meta, QString) end