经常出现慢订阅,和keepalive_timeout

环境

  • EMQX 版本:5.0.25 docker
  • 操作系统版本:centos7.6

重现此问题的步骤

1.总有设备出现慢订阅,而且是随机的,并不是某一台设备。也不是每一次订阅都慢。哪些因素会导致客户端出现慢订阅?

2.随机的出现一些设备keepalive_timeout超时,然后又重连,也有个别时候,超时后就连不上了,但是也没看出规律

预期行为

实际行为

部分日志

2023-06-08T02:22:38.619926+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:22:38.620041+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:23:40.009747+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:23:40.009841+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:24:41.093201+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:24:41.093303+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:25:42.328130+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:25:42.328235+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:26:43.082510+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:26:43.082605+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:27:44.144098+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:27:44.144223+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:28:45.540106+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:28:45.540204+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:29:46.106148+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:29:46.106266+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:30:47.221122+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:30:47.221242+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:31:48.277053+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:31:48.277168+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:32:49.250517+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:32:49.250588+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:33:50.085010+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:33:50.085098+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:34:51.495238+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:34:51.495364+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:35:52.107205+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:35:52.107358+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:36:53.239321+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:36:53.239437+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:37:54.301048+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:37:54.301152+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:38:55.371187+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:38:55.371297+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:39:56.338165+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:39:56.338280+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:40:57.156021+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:40:57.156124+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:41:58.389288+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:41:58.389372+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:42:59.245106+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:42:59.245197+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:44:00.413410+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:44:00.413467+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:45:01.255111+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:45:01.255192+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:46:02.142000+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:46:02.142083+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:47:03.758043+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:47:03.758152+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:48:04.380997+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:48:04.381087+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:49:05.441088+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:49:05.441215+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:50:06.217083+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:50:06.217180+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:51:07.242039+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:51:07.242129+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:52:08.240066+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:52:08.240181+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:53:09.406183+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:53:09.406296+00:00 [MQTT] 2304193432@172.17.0.1:18745 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:54:48.537513+00:00 [SOCKET] 2304193432@172.17.0.1:18745 msg: socket_force_closed, reason: keepalive_timeout
2023-06-08T02:54:48.537848+00:00 [BRIDGE] 2304193432@172.17.0.1:18745 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T02:54:49.158970+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=2304193432, ProtoName=MQTT, ProtoVsn=4, CleanStart=false, KeepAlive=60, Username=***1234, Password=******)
2023-06-08T02:54:49.159312+00:00 [SUBSCRIBE] 2304193432@172.17.0.1:18761 msg: subscribe, sub_id: 2304193432, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: []], topic: 2304193432
2023-06-08T02:54:49.159468+00:00 [UNSUBSCRIBE] 2304193432@172.17.0.1:18745 msg: unsubscribe, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: [], subid: 2304193432], topic: 2304193432
2023-06-08T02:54:49.159671+00:00 [BRIDGE] 2304193432@172.17.0.1:18745 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T02:54:49.159781+00:00 [SOCKET] 2304193432@172.17.0.1:18745 msg: emqx_connection_terminated, reason: {shutdown,takenover}
2023-06-08T02:54:49.161105+00:00 [BRIDGE] 2304193432@172.17.0.1:18761 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T02:54:49.161249+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0)
2023-06-08T02:54:49.358615+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_received, packet: SUBSCRIBE(Q1, R0, D0, PacketId=2 TopicFilters=[2304193432(#{nl => 0,qos => 1,rap => 0,rh => 0})])
2023-06-08T02:54:49.358824+00:00 [SUBSCRIBE] 2304193432@172.17.0.1:18761 msg: subscribe, sub_id: 2304193432, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: []], topic: 2304193432
2023-06-08T02:54:49.358987+00:00 [BRIDGE] 2304193432@172.17.0.1:18761 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T02:54:49.359147+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_sent, packet: SUBACK(Q0, R0, D0, PacketId=2, ReasonCodes=[1])
2023-06-08T02:54:53.337879+00:00 [BRIDGE] 2304193432@172.17.0.1:18761 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T02:54:53.338046+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_sent, packet: PUBLISH(Q0, R0, D0, Topic=2304193432, PacketId=undefined, Payload={"cmd": "getinfo"})
2023-06-08T02:54:56.113695+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_received, packet: PUBLISH(Q0, R0, D0, Topic=2304193432, PacketId=undefined, Payload={"imei":"864040067520917","imsi":"460085302102979","batt":4246,"signal":10})
2023-06-08T02:54:56.113851+00:00 [PUBLISH] 2304193432@172.17.0.1:18761 msg: publish_to, topic: 2304193432, payload: {"imei":"864040067520917","imsi":"460085302102979","batt":4246,"signal":10}
2023-06-08T02:54:56.114041+00:00 [BRIDGE] 2304193432@172.17.0.1:18761 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T02:54:56.114226+00:00 [BRIDGE] 2304193432@172.17.0.1:18761 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T02:54:56.114337+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_sent, packet: PUBLISH(Q0, R0, D0, Topic=2304193432, PacketId=undefined, Payload={"imei":"864040067520917","imsi":"460085302102979","batt":4246,"signal":10})
2023-06-08T02:55:49.833466+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:55:49.833584+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:56:50.883444+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:56:50.883526+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:57:52.088439+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:57:52.088533+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T02:58:53.138381+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T02:58:53.138478+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T03:00:04.018457+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T03:00:04.018550+00:00 [MQTT] 2304193432@172.17.0.1:18761 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T03:00:04.063676+00:00 [BRIDGE] 2304193432@172.17.0.1:18761 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:00:05.280764+00:00 [MQTT] 2304193432@172.17.0.1:18762 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=2304193432, ProtoName=MQTT, ProtoVsn=4, CleanStart=false, KeepAlive=60, Username=***1234, Password=******)
2023-06-08T03:00:05.281056+00:00 [SUBSCRIBE] 2304193432@172.17.0.1:18762 msg: subscribe, sub_id: 2304193432, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: []], topic: 2304193432
2023-06-08T03:00:05.281209+00:00 [UNSUBSCRIBE] 2304193432@172.17.0.1:18761 msg: unsubscribe, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: [], subid: 2304193432], topic: 2304193432
2023-06-08T03:00:05.281392+00:00 [BRIDGE] 2304193432@172.17.0.1:18761 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:00:05.281523+00:00 [SOCKET] 2304193432@172.17.0.1:18761 msg: emqx_connection_terminated, reason: {shutdown,takenover}
2023-06-08T03:00:05.282194+00:00 [BRIDGE] 2304193432@172.17.0.1:18762 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:00:05.282363+00:00 [MQTT] 2304193432@172.17.0.1:18762 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0)
2023-06-08T03:00:05.515500+00:00 [MQTT] 2304193432@172.17.0.1:18762 msg: mqtt_packet_received, packet: SUBSCRIBE(Q1, R0, D0, PacketId=2 TopicFilters=[2304193432(#{nl => 0,qos => 1,rap => 0,rh => 0})])
2023-06-08T03:00:05.515662+00:00 [SUBSCRIBE] 2304193432@172.17.0.1:18762 msg: subscribe, sub_id: 2304193432, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: []], topic: 2304193432
2023-06-08T03:00:05.515785+00:00 [BRIDGE] 2304193432@172.17.0.1:18762 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:00:05.515906+00:00 [MQTT] 2304193432@172.17.0.1:18762 msg: mqtt_packet_sent, packet: SUBACK(Q0, R0, D0, PacketId=2, ReasonCodes=[1])
2023-06-08T03:00:09.091838+00:00 [BRIDGE] 2304193432@172.17.0.1:18762 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:00:09.092005+00:00 [MQTT] 2304193432@172.17.0.1:18762 msg: mqtt_packet_sent, packet: PUBLISH(Q0, R0, D0, Topic=2304193432, PacketId=undefined, Payload={"cmd": "getinfo"})
2023-06-08T03:01:34.815600+00:00 [MQTT] 2304193432@172.17.0.1:18762 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T03:01:34.815682+00:00 [MQTT] 2304193432@172.17.0.1:18762 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T03:01:34.970677+00:00 [BRIDGE] 2304193432@172.17.0.1:18762 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:01:37.076584+00:00 [MQTT] 2304193432@172.17.0.1:18763 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=2304193432, ProtoName=MQTT, ProtoVsn=4, CleanStart=false, KeepAlive=60, Username=***1234, Password=******)
2023-06-08T03:01:37.076803+00:00 [SUBSCRIBE] 2304193432@172.17.0.1:18763 msg: subscribe, sub_id: 2304193432, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: []], topic: 2304193432
2023-06-08T03:01:37.076931+00:00 [UNSUBSCRIBE] 2304193432@172.17.0.1:18762 msg: unsubscribe, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: [], subid: 2304193432], topic: 2304193432
2023-06-08T03:01:37.077121+00:00 [BRIDGE] 2304193432@172.17.0.1:18762 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:01:37.077241+00:00 [SOCKET] 2304193432@172.17.0.1:18762 msg: emqx_connection_terminated, reason: {shutdown,takenover}
2023-06-08T03:01:37.077894+00:00 [BRIDGE] 2304193432@172.17.0.1:18763 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:01:37.078071+00:00 [MQTT] 2304193432@172.17.0.1:18763 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0)
2023-06-08T03:01:37.306426+00:00 [MQTT] 2304193432@172.17.0.1:18763 msg: mqtt_packet_received, packet: SUBSCRIBE(Q1, R0, D0, PacketId=2 TopicFilters=[2304193432(#{nl => 0,qos => 1,rap => 0,rh => 0})])
2023-06-08T03:01:37.306586+00:00 [SUBSCRIBE] 2304193432@172.17.0.1:18763 msg: subscribe, sub_id: 2304193432, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: []], topic: 2304193432
2023-06-08T03:01:37.306729+00:00 [BRIDGE] 2304193432@172.17.0.1:18763 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:01:37.306853+00:00 [MQTT] 2304193432@172.17.0.1:18763 msg: mqtt_packet_sent, packet: SUBACK(Q0, R0, D0, PacketId=2, ReasonCodes=[1])
2023-06-08T03:01:40.830781+00:00 [BRIDGE] 2304193432@172.17.0.1:18763 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:01:40.830942+00:00 [MQTT] 2304193432@172.17.0.1:18763 msg: mqtt_packet_sent, packet: PUBLISH(Q0, R0, D0, Topic=2304193432, PacketId=undefined, Payload={"cmd": "getinfo"})
2023-06-08T03:03:52.080495+00:00 [SOCKET] 2304193432@172.17.0.1:18763 msg: socket_force_closed, reason: keepalive_timeout
2023-06-08T03:03:52.080804+00:00 [BRIDGE] 2304193432@172.17.0.1:18763 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:04:08.314788+00:00 [MQTT] 2304193432@172.17.0.1:41590 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=2304193432, ProtoName=MQTT, ProtoVsn=4, CleanStart=false, KeepAlive=60, Username=***1234, Password=******)
2023-06-08T03:04:08.315061+00:00 [SUBSCRIBE] 2304193432@172.17.0.1:41590 msg: subscribe, sub_id: 2304193432, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: []], topic: 2304193432
2023-06-08T03:04:08.315236+00:00 [UNSUBSCRIBE] 2304193432@172.17.0.1:18763 msg: unsubscribe, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: [], subid: 2304193432], topic: 2304193432
2023-06-08T03:04:08.315449+00:00 [BRIDGE] 2304193432@172.17.0.1:18763 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:04:08.315598+00:00 [SOCKET] 2304193432@172.17.0.1:18763 msg: emqx_connection_terminated, reason: {shutdown,takenover}
2023-06-08T03:04:08.316331+00:00 [BRIDGE] 2304193432@172.17.0.1:41590 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:04:08.316476+00:00 [MQTT] 2304193432@172.17.0.1:41590 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0)
2023-06-08T03:04:08.554638+00:00 [MQTT] 2304193432@172.17.0.1:41590 msg: mqtt_packet_received, packet: SUBSCRIBE(Q1, R0, D0, PacketId=2 TopicFilters=[2304193432(#{nl => 0,qos => 1,rap => 0,rh => 0})])
2023-06-08T03:04:08.554816+00:00 [SUBSCRIBE] 2304193432@172.17.0.1:41590 msg: subscribe, sub_id: 2304193432, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: []], topic: 2304193432
2023-06-08T03:04:08.554941+00:00 [BRIDGE] 2304193432@172.17.0.1:41590 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:04:08.555061+00:00 [MQTT] 2304193432@172.17.0.1:41590 msg: mqtt_packet_sent, packet: SUBACK(Q0, R0, D0, PacketId=2, ReasonCodes=[1])
2023-06-08T03:04:12.086775+00:00 [BRIDGE] 2304193432@172.17.0.1:41590 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:04:12.086906+00:00 [MQTT] 2304193432@172.17.0.1:41590 msg: mqtt_packet_sent, packet: PUBLISH(Q0, R0, D0, Topic=2304193432, PacketId=undefined, Payload={"cmd": "getinfo"})
2023-06-08T03:04:31.494981+00:00 [BRIDGE] 2304193432@172.17.0.1:41590 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:04:32.013880+00:00 [MQTT] 2304193432@172.17.0.1:41592 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=2304193432, ProtoName=MQTT, ProtoVsn=4, CleanStart=false, KeepAlive=60, Username=***1234, Password=******)
2023-06-08T03:04:32.014194+00:00 [SUBSCRIBE] 2304193432@172.17.0.1:41592 msg: subscribe, sub_id: 2304193432, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: []], topic: 2304193432
2023-06-08T03:04:32.014378+00:00 [UNSUBSCRIBE] 2304193432@172.17.0.1:41590 msg: unsubscribe, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: [], subid: 2304193432], topic: 2304193432
2023-06-08T03:04:32.014546+00:00 [BRIDGE] 2304193432@172.17.0.1:41590 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:04:32.014671+00:00 [SOCKET] 2304193432@172.17.0.1:41590 msg: emqx_connection_terminated, reason: {shutdown,takenover}
2023-06-08T03:04:32.015520+00:00 [BRIDGE] 2304193432@172.17.0.1:41592 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:04:32.015707+00:00 [MQTT] 2304193432@172.17.0.1:41592 msg: mqtt_packet_sent, packet: CONNACK(Q0, R0, D0, AckFlags=1, ReasonCode=0)
2023-06-08T03:04:32.298712+00:00 [MQTT] 2304193432@172.17.0.1:41592 msg: mqtt_packet_received, packet: SUBSCRIBE(Q1, R0, D0, PacketId=2 TopicFilters=[2304193432(#{nl => 0,qos => 1,rap => 0,rh => 0})])
2023-06-08T03:04:32.298853+00:00 [SUBSCRIBE] 2304193432@172.17.0.1:41592 msg: subscribe, sub_id: 2304193432, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: []], topic: 2304193432
2023-06-08T03:04:32.298994+00:00 [BRIDGE] 2304193432@172.17.0.1:41592 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:04:32.299119+00:00 [MQTT] 2304193432@172.17.0.1:41592 msg: mqtt_packet_sent, packet: SUBACK(Q0, R0, D0, PacketId=2, ReasonCodes=[1])
2023-06-08T03:04:35.844830+00:00 [BRIDGE] 2304193432@172.17.0.1:41592 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:04:35.844998+00:00 [MQTT] 2304193432@172.17.0.1:41592 msg: mqtt_packet_sent, packet: PUBLISH(Q0, R0, D0, Topic=2304193432, PacketId=undefined, Payload={"cmd": "getinfo"})
2023-06-08T03:04:37.788641+00:00 [MQTT] 2304193432@172.17.0.1:41592 msg: mqtt_packet_received, packet: PUBLISH(Q0, R0, D0, Topic=2304193432, PacketId=undefined, Payload={"imei":"864040067520917","imsi":"460085302102979","batt":4215,"signal":10})
2023-06-08T03:04:37.788809+00:00 [PUBLISH] 2304193432@172.17.0.1:41592 msg: publish_to, topic: 2304193432, payload: {"imei":"864040067520917","imsi":"460085302102979","batt":4215,"signal":10}
2023-06-08T03:04:37.789000+00:00 [BRIDGE] 2304193432@172.17.0.1:41592 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:04:37.789202+00:00 [BRIDGE] 2304193432@172.17.0.1:41592 msg: bridge_action, bridge_id: webhook:2_webhook
2023-06-08T03:04:37.789309+00:00 [MQTT] 2304193432@172.17.0.1:41592 msg: mqtt_packet_sent, packet: PUBLISH(Q0, R0, D0, Topic=2304193432, PacketId=undefined, Payload={"imei":"864040067520917","imsi":"460085302102979","batt":4215,"signal":10})
2023-06-08T03:05:32.788689+00:00 [MQTT] 2304193432@172.17.0.1:41592 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T03:05:32.788790+00:00 [MQTT] 2304193432@172.17.0.1:41592 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)
2023-06-08T03:06:33.585969+00:00 [MQTT] 2304193432@172.17.0.1:41592 msg: mqtt_packet_received, packet: PINGREQ(Q0, R0, D0)
2023-06-08T03:06:33.586047+00:00 [MQTT] 2304193432@172.17.0.1:41592 msg: mqtt_packet_sent, packet: PINGRESP(Q0, R0, D0)

  1. 慢订阅先排除是不是 session = false 导致的
  2. keepalive_timeout 一般是客户端没有定时发送心跳导致的

如何排除,可以在dashboard中设置吗

有没有可能是服务器没有回应客户端的心跳造成的呢?

不可能,但如果你用的是 paho 的话,可能会出现因为消息队列太多了,导致 EMQX 的心跳回复一直没被 paho 处理到,而主动断开

keepalive_timeout超时问题,有没有可能是服务端的会话未过期,阻止了客户的重新连接。有这种可能性的存在吗?

曾经见过一个情况: 保持会话(cleansession = false) 的 paho 客户端刚刚 CONNECT 完成就做 同步地 订阅的话,会导致服务端和客户端出现同时等待 ACK 而导致 ping 超时的情况。改成异步订阅可以解决问题。

这里的session=false 是指的cleanSession=false吗