Merge pull request #12814 from SergeTupchiy/EMQX-12124-fix-msgs-api-client-shutdown
fix(emqx_mgmt): catch OOM shutdown exits properly when calling a conn procces
This commit is contained in:
commit
dd6f65f7dd
|
@ -711,5 +711,19 @@ call_conn(ConnMod, Pid, Req) ->
|
||||||
exit:R when R =:= shutdown; R =:= normal ->
|
exit:R when R =:= shutdown; R =:= normal ->
|
||||||
{error, shutdown};
|
{error, shutdown};
|
||||||
exit:{R, _} when R =:= shutdown; R =:= noproc ->
|
exit:{R, _} when R =:= shutdown; R =:= noproc ->
|
||||||
{error, shutdown}
|
{error, shutdown};
|
||||||
|
exit:{{shutdown, _OOMInfo}, _Location} ->
|
||||||
|
{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.
|
end.
|
||||||
|
|
|
@ -1232,6 +1232,8 @@ list_client_msgs(MsgType, ClientID, QString) ->
|
||||||
code => 'NOT_IMPLEMENTED',
|
code => 'NOT_IMPLEMENTED',
|
||||||
message => <<"API not implemented for persistent sessions">>
|
message => <<"API not implemented for persistent sessions">>
|
||||||
}};
|
}};
|
||||||
|
{error, Reason} ->
|
||||||
|
?INTERNAL_ERROR(Reason);
|
||||||
{Msgs, Meta = #{}} when is_list(Msgs) ->
|
{Msgs, Meta = #{}} when is_list(Msgs) ->
|
||||||
format_msgs_resp(MsgType, Msgs, Meta, QString)
|
format_msgs_resp(MsgType, Msgs, Meta, QString)
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Handle several errors in `/clients/{clientid}/mqueue_messages` and `/clients/{clientid}/inflight_messages` APIs:
|
||||||
|
|
||||||
|
- Internal timeout, which means that EMQX failed to get the list of Inflight/Mqueue messages within the default timeout of 5 s. This error may occur when the system is under a heavy load. The API will return 500 `{"code":"INTERNAL_ERROR","message":"timeout"}` response and log additional details.
|
||||||
|
- Client shutdown. The error may occur if the client connection is shutdown during the API call. The API will return 404 `{"code": "CLIENT_SHUTDOWN", "message": "Client connection has been shutdown"}` response in this case.
|
Loading…
Reference in New Issue