Merge pull request #11086 from zhongwencool/crash-listeners

fix: crash on emqx_ctl listeners
This commit is contained in:
JianBo He 2023-06-19 22:57:20 +08:00 committed by GitHub
commit b7deac6b79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 16 deletions

View File

@ -18,7 +18,12 @@ else
fi
apk update && apk add git curl
git clone -b develop-5.0 https://github.com/emqx/paho.mqtt.testing.git /paho.mqtt.testing
## Use 5.1.0 to bypass the newly added test cases in
## https://github.com/emqx/paho.mqtt.testing/pull/13
## This is a temporary solution for 5.1.0 release. After 5.1.0 release, we should use
## the develop-5.0 branch
git clone -b 5.1.0 https://github.com/emqx/paho.mqtt.testing.git /paho.mqtt.testing
pip install pytest==7.1.2 pytest-retry
pytest --retries 3 -v /paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host "$TARGET_HOST"

View File

@ -616,21 +616,28 @@ listeners([]) ->
Acceptors = maps:get(acceptors, Conf),
ProxyProtocol = maps:get(proxy_protocol, Conf, undefined),
Running = maps:get(running, Conf),
CurrentConns =
case emqx_listeners:current_conns(ID, Bind) of
{error, _} -> [];
CC -> [{current_conn, CC}]
end,
MaxConn =
case emqx_listeners:max_conns(ID, Bind) of
{error, _} -> [];
MC -> [{max_conns, MC}]
end,
ShutdownCount =
case emqx_listeners:shutdown_count(ID, Bind) of
{error, _} -> [];
SC -> [{shutdown_count, SC}]
end,
case Running of
true ->
CurrentConns =
case emqx_listeners:current_conns(ID, Bind) of
{error, _} -> [];
CC -> [{current_conn, CC}]
end,
MaxConn =
case emqx_listeners:max_conns(ID, Bind) of
{error, _} -> [];
MC -> [{max_conns, MC}]
end,
ShutdownCount =
case emqx_listeners:shutdown_count(ID, Bind) of
{error, _} -> [];
SC -> [{shutdown_count, SC}]
end;
false ->
CurrentConns = [],
MaxConn = [],
ShutdownCount = []
end,
Info =
[
{listen_on, {string, emqx_listeners:format_bind(Bind)}},