设备连接后掉线,reason: {shutdown,topic_filter_invalid}

环境

  • EMQX 版本:5.3.0
  • 操作系统版本:Debian GNU/Linux 11 (bullseye)

重现此问题的步骤

尚未稳定复现

预期行为

设备似乎在互踢,如果只是互踢的话让设备端排查即可,但是从日志中还看到了
[info] clientid: 12329671, msg: terminate, peername: 10.217.59.149:7159, username: USERNAME1, reason: {shutdown,topic_filter_invalid}这样的报错。
所以想咨询下,这个是什么含义?

从官网的描述来看Topic Filter invalid表示
主题过滤器的格式正确,但是不被服务端接受。比如主题过滤器的层级超过了服务端允许的最大数量限制,或者主题过滤器中包含了空格等不被当前服务端接受的字符。
但是从日志中看设备订阅的topic是c2d/USERNAME1/vvv,而服务端设置的最大主题层级为128,还未达到最大数量限制。主题过滤器中应该是指使用通配订阅时的不合法操作,还有其他原因吗?

实际行为

完整日志:

时间 日志
2025-01-06T11:53:31.437008+00:00 [MQTT] 12329671@10.217.59.152:33058 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=12329671, ProtoName=MQTT, ProtoVsn=5, CleanStart=false, KeepAlive=10, Username=USERNAME1, Password=), username: USERNAME1
2025-01-06T11:53:31.439321+00:00 [RULE] 12329671@10.217.59.152:33058 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164411439,sockname:10.130.14.10:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.217.59.152:33058,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:10,is_bridge:false,expiry_interval:0,event:client.connected,connected_at:1736164411438,conn_props:{User-Property:{}},clientid:12329671,clean_start:false}
2025-01-06T11:53:31.439393+00:00 [PUBLISH] 12329671@10.217.59.152:33058 msg: publish_to, topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164411439,sockname:10.130.14.10:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.217.59.152:33058,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:10,is_bridge:false,expiry_interval:0,event:client.connected,connected_at:1736164411438,conn_props:{User-Property:{}},clientid:12329671,clean_start:false}
2025-01-06T11:53:31.439686+00:00 [MQTT] 12329671@10.217.59.152:33058 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=0, ReasonCode=0), username: USERNAME1
2025-01-06T11:53:31.511714+00:00 [MQTT] 12329671@10.217.59.152:33058 msg: mqtt_packet_received, packet: SUBSCRIBE(Q1, R0, D0, PacketId=1 TopicFilters=[c2d/USERNAME1/vvv(#{nl => 0,qos => 1,rap => 0,rh => 0})]), username: USERNAME1
2025-01-06T11:53:31.512026+00:00 [AUTHZ] 12329671@10.217.59.152:33058 msg: authorization_module_nomatch, action: SUBSCRIBE(Q1), module: emqx_authz_client_info, topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:31.512086+00:00 [info] tag: AUTHZ, clientid: 12329671, msg: authorization_permission_allowed, peername: 10.217.59.152:33058, username: USERNAME1, topic: c2d/USERNAME1/vvv, action: SUBSCRIBE(Q1), source: file
2025-01-06T11:53:31.512287+00:00 [SUBSCRIBE] 12329671@10.217.59.152:33058 msg: subscribe, sub_id: 12329671, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: ], topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:31.512769+00:00 [MQTT] 12329671@10.217.59.152:33058 msg: mqtt_packet_sent, packet: SUBACK(Q0, R0, D0, PacketId=1, ReasonCodes=[1]), username: USERNAME1
2025-01-06T11:53:36.881859+00:00 [MQTT] 12329671@10.217.59.152:25311 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=12329671, ProtoName=MQTT, ProtoVsn=5, CleanStart=false, KeepAlive=10, Username=USERNAME1, Password=), username: USERNAME1
2025-01-06T11:53:36.883946+00:00 [SUBSCRIBE] 12329671@10.217.59.152:25311 msg: subscribe, sub_id: 12329671, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: ], topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:36.884839+00:00 [UNSUBSCRIBE] 12329671@10.217.59.152:33058 msg: unsubscribe, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: , subid: 12329671], topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:36.885254+00:00 [RULE] 12329671@10.217.59.152:33058 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164416885,sockname:10.130.14.10:1883,reason:takenover,proto_ver:5,proto_name:MQTT,peername:10.217.59.152:33058,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736164416884,disconn_props:{User-Property:{}},clientid:12329671}
2025-01-06T11:53:36.885291+00:00 [PUBLISH] 12329671@10.217.59.152:33058 msg: publish_to, topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164416885,sockname:10.130.14.10:1883,reason:takenover,proto_ver:5,proto_name:MQTT,peername:10.217.59.152:33058,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736164416884,disconn_props:{User-Property:{}},clientid:12329671}
2025-01-06T11:53:36.885566+00:00 [MQTT] 12329671@10.217.59.152:33058 msg: mqtt_packet_sent, packet: DISCONNECT(Q0, R0, D0, ReasonCode=142), username: USERNAME1
2025-01-06T11:53:36.885729+00:00 [SOCKET] 12329671@10.217.59.152:33058 msg: emqx_connection_terminated, reason: {shutdown,takenover}, username: USERNAME1
2025-01-06T11:53:36.885882+00:00 [info] clientid: 12329671, msg: terminate, peername: 10.217.59.152:33058, username: USERNAME1, reason: {shutdown,takenover}
2025-01-06T11:53:36.887681+00:00 [RULE] 12329671@10.217.59.152:25311 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164416887,sockname:10.128.16.9:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.217.59.152:25311,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-0.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:10,is_bridge:false,expiry_interval:0,event:client.connected,connected_at:1736164416886,conn_props:{User-Property:{}},clientid:12329671,clean_start:false}
2025-01-06T11:53:36.887864+00:00 [PUBLISH] 12329671@10.217.59.152:25311 msg: publish_to, topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164416887,sockname:10.128.16.9:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.217.59.152:25311,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-0.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:10,is_bridge:false,expiry_interval:0,event:client.connected,connected_at:1736164416886,conn_props:{User-Property:{}},clientid:12329671,clean_start:false}
2025-01-06T11:53:36.888688+00:00 [MQTT] 12329671@10.217.59.152:25311 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0), username: USERNAME1
2025-01-06T11:53:37.359592+00:00 [MQTT] 12329671@10.217.59.152:25311 msg: mqtt_packet_received, packet: SUBSCRIBE(Q1, R0, D0, PacketId=1 TopicFilters=[(#{nl => 0,qos => 1,rap => 0,rh => 0})]), username: USERNAME1
2025-01-06T11:53:37.359792+00:00 [MQTT] 12329671@10.217.59.152:25311 msg: mqtt_packet_sent, packet: DISCONNECT(Q0, R0, D0, ReasonCode=143), username: USERNAME1
2025-01-06T11:53:37.360110+00:00 [SOCKET] 12329671@10.217.59.152:25311 msg: socket_force_closed, reason: topic_filter_invalid, username: USERNAME1
2025-01-06T11:53:37.360703+00:00 [RULE] 12329671@10.217.59.152:25311 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164417360,sockname:10.128.16.9:1883,reason:topic_filter_invalid,proto_ver:5,proto_name:MQTT,peername:10.217.59.152:25311,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-0.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736164417360,disconn_props:{User-Property:{}},clientid:12329671}
2025-01-06T11:53:37.360762+00:00 [PUBLISH] 12329671@10.217.59.152:25311 msg: publish_to, topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164417360,sockname:10.128.16.9:1883,reason:topic_filter_invalid,proto_ver:5,proto_name:MQTT,peername:10.217.59.152:25311,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-0.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736164417360,disconn_props:{User-Property:{}},clientid:12329671}
2025-01-06T11:53:37.361370+00:00 [SOCKET] 12329671@10.217.59.152:25311 msg: emqx_connection_terminated, reason: {shutdown,topic_filter_invalid}, username: USERNAME1
2025-01-06T11:53:37.361402+00:00 [info] clientid: 12329671, msg: terminate, peername: 10.217.59.152:25311, username: USERNAME1, reason: {shutdown,topic_filter_invalid}
2025-01-06T11:53:41.428802+00:00 [MQTT] 12329671@10.217.59.153:15845 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=12329671, ProtoName=MQTT, ProtoVsn=5, CleanStart=false, KeepAlive=10, Username=USERNAME1, Password=), username: USERNAME1
2025-01-06T11:53:41.431348+00:00 [RULE] 12329671@10.217.59.153:15845 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164421431,sockname:10.130.14.10:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.217.59.153:15845,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:10,is_bridge:false,expiry_interval:0,event:client.connected,connected_at:1736164421431,conn_props:{User-Property:{}},clientid:12329671,clean_start:false}
2025-01-06T11:53:41.431410+00:00 [PUBLISH] 12329671@10.217.59.153:15845 msg: publish_to, topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164421431,sockname:10.130.14.10:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.217.59.153:15845,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:10,is_bridge:false,expiry_interval:0,event:client.connected,connected_at:1736164421431,conn_props:{User-Property:{}},clientid:12329671,clean_start:false}
2025-01-06T11:53:41.431666+00:00 [MQTT] 12329671@10.217.59.153:15845 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=0, ReasonCode=0), username: USERNAME1
2025-01-06T11:53:41.502998+00:00 [MQTT] 12329671@10.217.59.153:15845 msg: mqtt_packet_received, packet: SUBSCRIBE(Q1, R0, D0, PacketId=1 TopicFilters=[c2d/USERNAME1/vvv(#{nl => 0,qos => 1,rap => 0,rh => 0})]), username: USERNAME1
2025-01-06T11:53:41.503171+00:00 [AUTHZ] 12329671@10.217.59.153:15845 msg: authorization_module_nomatch, action: SUBSCRIBE(Q1), module: emqx_authz_client_info, topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:41.503222+00:00 [info] tag: AUTHZ, clientid: 12329671, msg: authorization_permission_allowed, peername: 10.217.59.153:15845, username: USERNAME1, topic: c2d/USERNAME1/vvv, action: SUBSCRIBE(Q1), source: file
2025-01-06T11:53:41.503487+00:00 [SUBSCRIBE] 12329671@10.217.59.153:15845 msg: subscribe, sub_id: 12329671, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: ], topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:41.503783+00:00 [MQTT] 12329671@10.217.59.153:15845 msg: mqtt_packet_sent, packet: SUBACK(Q0, R0, D0, PacketId=1, ReasonCodes=[1]), username: USERNAME1
2025-01-06T11:53:52.558414+00:00 [MQTT] 12329671@10.217.59.153:15845 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0), username: USERNAME1
2025-01-06T11:53:52.558528+00:00 [MQTT] 12329671@10.217.59.153:15845 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0), username: USERNAME1
2025-01-06T11:53:58.133729+00:00 [MQTT] 12329671@10.217.59.148:35106 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=12329671, ProtoName=MQTT, ProtoVsn=5, CleanStart=false, KeepAlive=10, Username=USERNAME1, Password=), username: USERNAME1
2025-01-06T11:53:58.135540+00:00 [SUBSCRIBE] 12329671@10.217.59.148:35106 msg: subscribe, sub_id: 12329671, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: ], topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:58.136459+00:00 [UNSUBSCRIBE] 12329671@10.217.59.153:15845 msg: unsubscribe, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: , subid: 12329671], topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:58.136937+00:00 [RULE] 12329671@10.217.59.153:15845 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164438136,sockname:10.130.14.10:1883,reason:takenover,proto_ver:5,proto_name:MQTT,peername:10.217.59.153:15845,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736164438136,disconn_props:{User-Property:{}},clientid:12329671}
2025-01-06T11:53:58.136977+00:00 [PUBLISH] 12329671@10.217.59.153:15845 msg: publish_to, topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164438136,sockname:10.130.14.10:1883,reason:takenover,proto_ver:5,proto_name:MQTT,peername:10.217.59.153:15845,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736164438136,disconn_props:{User-Property:{}},clientid:12329671}
2025-01-06T11:53:58.138321+00:00 [MQTT] 12329671@10.217.59.153:15845 msg: mqtt_packet_sent, packet: DISCONNECT(Q0, R0, D0, ReasonCode=142), username: USERNAME1
2025-01-06T11:53:58.138527+00:00 [SOCKET] 12329671@10.217.59.153:15845 msg: emqx_connection_terminated, reason: {shutdown,takenover}, username: USERNAME1
2025-01-06T11:53:58.138617+00:00 [info] clientid: 12329671, msg: terminate, peername: 10.217.59.153:15845, username: USERNAME1, reason: {shutdown,takenover}
2025-01-06T11:53:58.139805+00:00 [RULE] 12329671@10.217.59.148:35106 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164438139,sockname:10.128.16.9:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.217.59.148:35106,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-0.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:10,is_bridge:false,expiry_interval:0,event:client.connected,connected_at:1736164438139,conn_props:{User-Property:{}},clientid:12329671,clean_start:false}
2025-01-06T11:53:58.139893+00:00 [PUBLISH] 12329671@10.217.59.148:35106 msg: publish_to, topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164438139,sockname:10.128.16.9:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.217.59.148:35106,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-0.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:10,is_bridge:false,expiry_interval:0,event:client.connected,connected_at:1736164438139,conn_props:{User-Property:{}},clientid:12329671,clean_start:false}
2025-01-06T11:53:58.140237+00:00 [MQTT] 12329671@10.217.59.148:35106 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0), username: USERNAME1
2025-01-06T11:53:58.474615+00:00 [MQTT] 12329671@10.217.59.149:48607 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=12329671, ProtoName=MQTT, ProtoVsn=5, CleanStart=false, KeepAlive=10, Username=USERNAME1, Password=), username: USERNAME1
2025-01-06T11:53:58.476550+00:00 [SUBSCRIBE] 12329671@10.217.59.149:48607 msg: subscribe, sub_id: 12329671, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: ], topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:58.477281+00:00 [UNSUBSCRIBE] 12329671@10.217.59.148:35106 msg: unsubscribe, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: , subid: 12329671], topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:58.477693+00:00 [RULE] 12329671@10.217.59.148:35106 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164438477,sockname:10.128.16.9:1883,reason:takenover,proto_ver:5,proto_name:MQTT,peername:10.217.59.148:35106,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-0.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736164438477,disconn_props:{User-Property:{}},clientid:12329671}
2025-01-06T11:53:58.477734+00:00 [PUBLISH] 12329671@10.217.59.148:35106 msg: publish_to, topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164438477,sockname:10.128.16.9:1883,reason:takenover,proto_ver:5,proto_name:MQTT,peername:10.217.59.148:35106,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-0.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736164438477,disconn_props:{User-Property:{}},clientid:12329671}
2025-01-06T11:53:58.477991+00:00 [MQTT] 12329671@10.217.59.148:35106 msg: mqtt_packet_sent, packet: DISCONNECT(Q0, R0, D0, ReasonCode=142), username: USERNAME1
2025-01-06T11:53:58.478247+00:00 [SOCKET] 12329671@10.217.59.148:35106 msg: emqx_connection_terminated, reason: {shutdown,takenover}, username: USERNAME1
2025-01-06T11:53:58.478615+00:00 [info] clientid: 12329671, msg: terminate, peername: 10.217.59.148:35106, username: USERNAME1, reason: {shutdown,takenover}
2025-01-06T11:53:58.479674+00:00 [RULE] 12329671@10.217.59.149:48607 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164438479,sockname:10.130.14.10:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.217.59.149:48607,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:10,is_bridge:false,expiry_interval:0,event:client.connected,connected_at:1736164438479,conn_props:{User-Property:{}},clientid:12329671,clean_start:false}
2025-01-06T11:53:58.479745+00:00 [PUBLISH] 12329671@10.217.59.149:48607 msg: publish_to, topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164438479,sockname:10.130.14.10:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.217.59.149:48607,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:10,is_bridge:false,expiry_interval:0,event:client.connected,connected_at:1736164438479,conn_props:{User-Property:{}},clientid:12329671,clean_start:false}
2025-01-06T11:53:58.480033+00:00 [MQTT] 12329671@10.217.59.149:48607 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0), username: USERNAME1
2025-01-06T11:53:58.550395+00:00 [MQTT] 12329671@10.217.59.149:48607 msg: mqtt_packet_received, packet: SUBSCRIBE(Q1, R0, D0, PacketId=1 TopicFilters=[c2d/USERNAME1/vvv(#{nl => 0,qos => 1,rap => 0,rh => 0})]), username: USERNAME1
2025-01-06T11:53:58.550638+00:00 [AUTHZ] 12329671@10.217.59.149:48607 msg: authorization_module_nomatch, action: SUBSCRIBE(Q1), module: emqx_authz_client_info, topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:58.550706+00:00 [info] tag: AUTHZ, clientid: 12329671, msg: authorization_permission_allowed, peername: 10.217.59.149:48607, username: USERNAME1, topic: c2d/USERNAME1/vvv, action: SUBSCRIBE(Q1), source: file
2025-01-06T11:53:58.550968+00:00 [SUBSCRIBE] 12329671@10.217.59.149:48607 msg: subscribe, sub_id: 12329671, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: ], topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:58.551041+00:00 [MQTT] 12329671@10.217.59.149:48607 msg: mqtt_packet_sent, packet: SUBACK(Q0, R0, D0, PacketId=1, ReasonCodes=[1]), username: USERNAME1
2025-01-06T11:53:58.799477+00:00 [MQTT] 12329671@10.217.59.151:7726 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=12329671, ProtoName=MQTT, ProtoVsn=5, CleanStart=false, KeepAlive=10, Username=USERNAME1, Password=), username: USERNAME1
2025-01-06T11:53:58.801287+00:00 [SUBSCRIBE] 12329671@10.217.59.151:7726 msg: subscribe, sub_id: 12329671, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: ], topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:58.802072+00:00 [UNSUBSCRIBE] 12329671@10.217.59.149:48607 msg: unsubscribe, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: , subid: 12329671], topic: c2d/USERNAME1/vvv, username: USERNAME1
2025-01-06T11:53:58.802571+00:00 [RULE] 12329671@10.217.59.149:48607 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164438802,sockname:10.130.14.10:1883,reason:takenover,proto_ver:5,proto_name:MQTT,peername:10.217.59.149:48607,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736164438802,disconn_props:{User-Property:{}},clientid:12329671}
2025-01-06T11:53:58.802669+00:00 [PUBLISH] 12329671@10.217.59.149:48607 msg: publish_to, topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164438802,sockname:10.130.14.10:1883,reason:takenover,proto_ver:5,proto_name:MQTT,peername:10.217.59.149:48607,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736164438802,disconn_props:{User-Property:{}},clientid:12329671}
2025-01-06T11:53:58.803065+00:00 [MQTT] 12329671@10.217.59.149:48607 msg: mqtt_packet_sent, packet: DISCONNECT(Q0, R0, D0, ReasonCode=142), username: USERNAME1
2025-01-06T11:53:58.803261+00:00 [SOCKET] 12329671@10.217.59.149:48607 msg: emqx_connection_terminated, reason: {shutdown,takenover}, username: USERNAME1
2025-01-06T11:53:58.803450+00:00 [info] clientid: 12329671, msg: terminate, peername: 10.217.59.149:48607, username: USERNAME1, reason: {shutdown,takenover}
2025-01-06T11:53:58.804531+00:00 [RULE] 12329671@10.217.59.151:7726 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164438804,sockname:10.128.16.9:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.217.59.151:7726,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-0.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:10,is_bridge:false,expiry_interval:0,event:client.connected,connected_at:1736164438804,conn_props:{User-Property:{}},clientid:12329671,clean_start:false}
2025-01-06T11:53:58.804603+00:00 [PUBLISH] 12329671@10.217.59.151:7726 msg: publish_to, topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164438804,sockname:10.128.16.9:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.217.59.151:7726,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-0.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:10,is_bridge:false,expiry_interval:0,event:client.connected,connected_at:1736164438804,conn_props:{User-Property:{}},clientid:12329671,clean_start:false}
2025-01-06T11:53:58.805145+00:00 [MQTT] 12329671@10.217.59.151:7726 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0), username: USERNAME1
2025-01-06T11:53:59.272603+00:00 [MQTT] 12329671@10.217.59.151:7726 msg: mqtt_packet_received, packet: SUBSCRIBE(Q1, R0, D0, PacketId=1 TopicFilters=[(#{nl => 0,qos => 1,rap => 0,rh => 0})]), username: USERNAME1
2025-01-06T11:53:59.273073+00:00 [MQTT] 12329671@10.217.59.151:7726 msg: mqtt_packet_sent, packet: DISCONNECT(Q0, R0, D0, ReasonCode=143), username: USERNAME1
2025-01-06T11:53:59.273462+00:00 [SOCKET] 12329671@10.217.59.151:7726 msg: socket_force_closed, reason: topic_filter_invalid, username: USERNAME1
2025-01-06T11:53:59.274639+00:00 [RULE] 12329671@10.217.59.151:7726 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164439273,sockname:10.128.16.9:1883,reason:topic_filter_invalid,proto_ver:5,proto_name:MQTT,peername:10.217.59.151:7726,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-0.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736164439273,disconn_props:{User-Property:{}},clientid:12329671}
2025-01-06T11:53:59.274902+00:00 [PUBLISH] 12329671@10.217.59.151:7726 msg: publish_to, topic: CLIENT, username: USERNAME1, payload: {username:USERNAME1,timestamp:1736164439273,sockname:10.128.16.9:1883,reason:topic_filter_invalid,proto_ver:5,proto_name:MQTT,peername:10.217.59.151:7726,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-0.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736164439273,disconn_props:{User-Property:{}},clientid:12329671}
2025-01-06T11:53:59.275925+00:00 [SOCKET] 12329671@10.217.59.151:7726 msg: emqx_connection_terminated, reason: {shutdown,topic_filter_invalid}, username: USERNAME1
2025-01-06T11:53:59.276106+00:00 [info] clientid: 12329671, msg: terminate, peername: 10.217.59.151:7726, username: USERNAME1, reason: {shutdown,topic_filter_invalid}
2025-01-06T11:54:01.340113+00:00 [API] 12329671@ msg: trace_stopping,
2025-01-06T11:54:01.341119+00:00 [API] 12329671@ msg: trace_stopping,


同时还需要注意的是上面有 2 次的 takeover,

你们找找设备分析吧。

感谢解答,是否可以将设备互踢设备订阅了错误的topic导致被踢这两个问题分开考虑。

也就是是这两个问题不会互相影响,可以单独复现出来,还是说只有当设备在互踢时同时设备订阅了错误的topic才会导致被踢。

因为我在尝试复现,发现订阅 空字符或者是null并不会导致设备被踢掉,从日志里看的话没有发现有类似的日志。这里的空是指空字符还是null呢还是有其他含义?

复现代码:
@Override
public void connectComplete(boolean b, String s) {
try {
// 先订阅一个正常的
MqttClientConfigV5.getMqttClient().subscribe(“bbb/hb/detect”,0);
// 订阅一个异常的
MqttClientConfigV5.getMqttClient().subscribe(“”,0);
}catch (Exception e){
e.printStackTrace();
}

    log.info("connectComplete....");
}

日志如下:

2025-01-07T03:26:18.141270+00:00 [MQTT] pong_demo_v5@10.129.2.1:15964 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=pong_demo_v5, ProtoName=MQTT, ProtoVsn=5, CleanStart=false, KeepAlive=60, Username=veh_pong_demo, Password=******), username: veh_pong_demo
2025-01-07T03:26:18.142564+00:00 [SUBSCRIBE] pong_demo_v5@10.129.2.1:15964 msg: subscribe, sub_id: pong_demo_v5, sub_opts: [nl: 0, qos: 0, rap: 0, rh: 0, sub_props: ], topic: bbb/hb/detect, username: veh_pong_demo
2025-01-07T03:26:18.142907+00:00 [UNSUBSCRIBE] pong_demo_v5@10.129.2.1:50809 msg: unsubscribe, sub_opts: [nl: 0, qos: 0, rap: 0, rh: 0, sub_props: , subid: pong_demo_v5], topic: bbb/hb/detect, username: veh_pong_demo
2025-01-07T03:26:18.143097+00:00 [debug] clientid: pong_demo_v5, msg: emqx_channel_takeover_end, peername: 10.129.2.1:50809, username: veh_pong_demo
2025-01-07T03:26:18.143417+00:00 [BRIDGE] pong_demo_v5@10.129.2.1:50809 msg: bridge_action, bridge_id: {bridge_v2,http,‘CLIENT_ACTION_LOCALQA’}, username: veh_pong_demo
2025-01-07T03:26:18.143667+00:00 [RULE] pong_demo_v5@10.129.2.1:50809 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: veh_pong_demo, payload: {username:veh_pong_demo,timestamp:1736220378143,sockname:10.130.14.10:1883,reason:takenover,proto_ver:5,proto_name:MQTT,peername:10.129.2.1:50809,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736220378143,disconn_props:{User-Property:{}},clientid:pong_demo_v5}
2025-01-07T03:26:18.143753+00:00 [PUBLISH] pong_demo_v5@10.129.2.1:50809 msg: publish_to, topic: CLIENT, username: veh_pong_demo, payload: {username:veh_pong_demo,timestamp:1736220378143,sockname:10.130.14.10:1883,reason:takenover,proto_ver:5,proto_name:MQTT,peername:10.129.2.1:50809,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,metadata:{rule_id:client_action},event:client.disconnected,disconnected_at:1736220378143,disconn_props:{User-Property:{}},clientid:pong_demo_v5}
2025-01-07T03:26:18.143955+00:00 [BRIDGE] pong_demo_v5@10.129.2.1:50809 msg: bridge_action, bridge_id: {bridge_v2,http,‘CLIENT_ACTION’}, username: veh_pong_demo
2025-01-07T03:26:18.144065+00:00 [BRIDGE] pong_demo_v5@10.129.2.1:50809 msg: bridge_action, bridge_id: {bridge_v2,http,‘ClientAction’}, username: veh_pong_demo
2025-01-07T03:26:18.144216+00:00 [SOCKET] pong_demo_v5@10.129.2.1:50809 msg: emqx_connection_terminated, reason: {shutdown,takenover}, username: veh_pong_demo
2025-01-07T03:26:18.144388+00:00 [info] clientid: pong_demo_v5, msg: terminate, peername: 10.129.2.1:50809, username: veh_pong_demo, reason: {shutdown,takenover}
2025-01-07T03:26:18.145017+00:00 [BRIDGE] pong_demo_v5@10.129.2.1:15964 msg: bridge_action, bridge_id: {bridge_v2,http,‘CLIENT_ACTION_LOCALQA’}, username: veh_pong_demo
2025-01-07T03:26:18.145192+00:00 [RULE] pong_demo_v5@10.129.2.1:15964 msg: republish_message, flags: [retain: false], pub_props: [User-Property: ], topic: CLIENT, username: veh_pong_demo, payload: {username:veh_pong_demo,timestamp:1736220378145,sockname:10.130.14.10:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.129.2.1:15964,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:60,is_bridge:false,expiry_interval:600,event:client.connected,connected_at:1736220378144,conn_props:{User-Property:{},Session-Expiry-Interval:600},clientid:pong_demo_v5,clean_start:false}
2025-01-07T03:26:18.145307+00:00 [PUBLISH] pong_demo_v5@10.129.2.1:15964 msg: publish_to, topic: CLIENT, username: veh_pong_demo, payload: {username:veh_pong_demo,timestamp:1736220378145,sockname:10.130.14.10:1883,receive_maximum:500,proto_ver:5,proto_name:MQTT,peername:10.129.2.1:15964,node:jqp06qa-mob01-dmz@jqp06qa-mob01-dmz-1.jqp06qa-mob01-dmz-headless.mqttmp.svc.cluster.local,mountpoint:undefined,metadata:{rule_id:client_action},keepalive:60,is_bridge:false,expiry_interval:600,event:client.connected,connected_at:1736220378144,conn_props:{User-Property:{},Session-Expiry-Interval:600},clientid:pong_demo_v5,clean_start:false}
2025-01-07T03:26:18.145447+00:00 [BRIDGE] pong_demo_v5@10.129.2.1:15964 msg: bridge_action, bridge_id: {bridge_v2,http,‘CLIENT_ACTION’}, username: veh_pong_demo
2025-01-07T03:26:18.145645+00:00 [BRIDGE] pong_demo_v5@10.129.2.1:15964 msg: bridge_action, bridge_id: {bridge_v2,http,‘ClientAction’}, username: veh_pong_demo
2025-01-07T03:26:18.146171+00:00 [debug] clientid: pong_demo_v5, msg: insert_channel_info, peername: 10.129.2.1:15964, username: veh_pong_demo
2025-01-07T03:26:18.146348+00:00 [MQTT] pong_demo_v5@10.129.2.1:15964 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0), username: veh_pong_demo
2025-01-07T03:26:18.191776+00:00 [debug] tag: MQTT, clientid: pong_demo_v5, msg: raw_bin_received, peername: 10.129.2.1:15964, username: veh_pong_demo, bin: 8213000100000D6262622F68622F64657465637400, size: 21, type: hex
2025-01-07T03:26:18.192118+00:00 [MQTT] pong_demo_v5@10.129.2.1:15964 msg: mqtt_packet_received, packet: SUBSCRIBE(Q1, R0, D0, PacketId=1 TopicFilters=[bbb/hb/detect(#{nl => 0,qos => 0,rap => 0,rh => 0})]), username: veh_pong_demo
2025-01-07T03:26:18.192293+00:00 [AUTHZ] pong_demo_v5@10.129.2.1:15964 msg: authorization_module_nomatch, action: SUBSCRIBE(Q0), module: emqx_authz_client_info, topic: bbb/hb/detect, username: veh_pong_demo
2025-01-07T03:26:18.192431+00:00 [info] tag: AUTHZ, clientid: pong_demo_v5, msg: authorization_permission_allowed, peername: 10.129.2.1:15964, username: veh_pong_demo, topic: bbb/hb/detect, action: SUBSCRIBE(Q0), source: file
2025-01-07T03:26:18.192663+00:00 [SUBSCRIBE] pong_demo_v5@10.129.2.1:15964 msg: subscribe, sub_id: pong_demo_v5, sub_opts: [nl: 0, qos: 0, rap: 0, rh: 0, sub_props: ], topic: bbb/hb/detect, username: veh_pong_demo
2025-01-07T03:26:18.192761+00:00 [MQTT] pong_demo_v5@10.129.2.1:15964 msg: mqtt_packet_sent, packet: SUBACK(Q0, R0, D0, PacketId=1, ReasonCodes=[0]), username: veh_pong_demo
2025-01-07T03:26:18.193025+00:00 [debug] clientid: pong_demo_v5, msg: insert_channel_info, peername: 10.129.2.1:15964, username: veh_pong_demo
2025-01-07T03:26:22.894576+00:00 [API] pong_demo_v5@ msg: trace_stopping,


您的代码没生效,订阅的不是空。

好的,我再尝试下,谢谢。