订阅主题丢失

问题1:请问MQTT出现[kicked]标识的掉线是什么场景导致的?掉线日志如下:
2024-10-24T11:14:01.146421+08:00 [debug] clientid: id-mqtt-1021, msg: maybe_publish_willmsg_session_ends, peername: XXX.XX.XX.XX:34592, username: test, reason: kicked
2024-10-24T11:14:01.146769+08:00 [debug] tag: AUTHZ, clientid: id-mqtt-1021, msg: authorization_module_nomatch, peername: XXX.XX.XX.XX:34592, username: test, topic: willTopic, module: emqx_authz_client_info, action: PUBLISH(Q0,R1)
2024-10-24T11:14:01.147143+08:00 [info] tag: AUTHZ, clientid: id-mqtt-1021, msg: authorization_permission_allowed, peername: XXX.XX.XX.XX:34592, username: test, topic: willTopic, source: file, action: PUBLISH(Q0,R1)
2024-10-24T11:14:01.147516+08:00 [debug] tag: PUBLISH, clientid: id-mqtt-1021, msg: publish_to, peername: XXX.XX.XX.XX:34592, username: test, topic: willTopic, payload: id-mqtt-1021-ds1/XXX.XX.XX.XX1729725001368与服务器断开连接
2024-10-24T11:14:01.148000+08:00 [debug] tag: SOCKET, clientid: id-mqtt-1021, msg: emqx_connection_terminated, peername: XXX.XX.XX.XX:34592, username: test, reason: {shutdown,kicked}
2024-10-24T11:14:01.148329+08:00 [info] clientid: id-mqtt-1021, msg: terminate, peername: XXX.XX.XX.XX:34592, username: test, reason: {shutdown,kicked}
2024-10-24T11:14:02.457175+08:00 [debug] tag: MQTT, msg: raw_bin_received, peername: XXX.XX.XX.XX:41826, size: 152, type: hex, bin: 10950100044D51545404E6000A0012616C61726D2D69642D6D7174742D31303231000977696C6C546F7069630048616C61726D2D69642D6D7174742D313032312D6473312F3137322E32332E32302E313631373239373235303031333638E4B88EE69C8DE58AA1E599A8E696ADE5BC80E8BF9EE68EA5000B616C6572746F725F7A68790013616C6572746F725F6577302932322E3732776E
2024-10-24T11:14:02.457668+08:00 [debug] tag: MQTT, clientid: id-mqtt-1021, msg: mqtt_packet_received, peername: XXX.XX.XX.XX:41826, username: test, packet: CONNECT(Q0, R0, D0, ClientId=id-mqtt-1021, ProtoName=MQTT, ProtoVsn=4, CleanStart=true, KeepAlive=10, Username=test, Password=******, Will(Q0, R1, Topic=willTopic Payload=id-mqtt-1021-ds1/XXX.XX.XX.XX1729725001368与服务器断开连接))

问题2:EMQX会出现客户端自动丢失订阅topic的情况吗?我这边不定时会出现,日志如下:
2024-10-18T17:30:46.614585+08:00 [debug] tag: MQTT, clientid: test-id, msg: mqtt_packet_sent, peername: xxx.xxx.xx.xx:44144, username: test, packet: PUBLISH(Q0, R0, D0, Topic=/test/up/, PacketId=undefined, Payload={“test”:“123”})
2024-10-18T17:30:50.788561+08:00 [debug] tag: UNSUBSCRIBE, clientid: test-id, msg: unsubscribe, peername: xxx.xxx.xx.xx:44144, username: test, topic: /test/up/, sub_opts: #{nl => 0,qos => 0,subid => <<“test-id”>>,rap => 0,rh => 0,sub_props => #{}}
2024-10-18T17:30:51.344331+08:00 [debug] tag: MQTT, clientid: test-id, msg: raw_bin_received, peername: xxx.xxx.xx.xx:44144, username: test, size: 2, type: hex, bin: C000
2024-10-18T17:30:51.344559+08:00 [debug] tag: MQTT, clientid: test-id, msg: mqtt_packet_received, peername: xxx.xxx.xx.xx:44144, username: test, packet: PINGREQ(Q0, R0, D0)
2024-10-18T17:30:51.344709+08:00 [debug] tag: MQTT, clientid: test-id, msg: mqtt_packet_sent, peername: xxx.xxx.xx.xx:44144, username: test, packet: PINGRESP(Q0, R0, D0)

看这两个消息,感觉都是因为客户端被踢了造成的。你检查一下client id有没有重复,以及服务器的网络状况和负载情况。

可以找个测试环境验证一下,如果只连接100个客户端,会不会出现类似的问题。