我是EMQX小白,大佬们帮忙看一下~
在一台电脑上,用两个matlab文件分别连接mqtt进行数据通信。在运行第二个程序时,第一个连接会自动断开,是什么原因呢?
(msg: terminate
reason: {shutdown,tcp_closed})
环境
- EMQX 版本:4.4.18
- 操作系统版本:Windows 10
重现此问题的步骤
- 运行central_unit
- 运行robots
预期行为
实际行为
central_unit的日志:
2023-06-21T10:43:35.131000+08:00 [debug] 127.0.0.1:1229 [Channel] RECV CONNECT(Q0, R0, D0, ClientId=central_unit, ProtoName=MQTT, ProtoVsn=4, CleanStart=true, KeepAlive=60, Username=undefined, Password=undefined)
2023-06-21T10:43:35.131000+08:00 [debug] 127.0.0.1:1229 client_id: <<"central_unit">>
msg: insert_channel_info
2023-06-21T10:43:35.131000+08:00 [debug] 127.0.0.1:1229 [MQTT] SEND CONNACK(Q0, R0, D0, AckFlags=0, ReasonCode=0)
2023-06-21T10:43:35.131000+08:00 [debug] 127.0.0.1:1229 [MQTT] RECV <<130,17,0,1,0,12,114,111,98,111,116,115,95,115,116,97,116,101,0>>
2023-06-21T10:43:35.131000+08:00 [debug] 127.0.0.1:1229 [MQTT] RECV SUBSCRIBE(Q1, R0, D0, PacketId=1, TopicFilters=[{<<"robots_state">>,#{nl => 0,qos => 0,rap => 0,rh => 0}}])
2023-06-21T10:43:35.131000+08:00 [info] 127.0.0.1:1229 central_unit SUBSCRIBE robots_state: Options: #{nl => 0,qos => 0,rap => 0,rh => 0,sub_props => #{}}
2023-06-21T10:43:35.131000+08:00 [debug] 127.0.0.1:1229 [MQTT] SEND SUBACK(Q0, R0, D0, PacketId=1, ReasonCodes=[0])
2023-06-21T10:43:56.748000+08:00 [debug] 127.0.0.1:1229 [MQTT] SEND PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.748000+08:00 [info] 127.0.0.1:1229 msg: terminate
reason: {shutdown,tcp_closed}
robots的日志:
2023-06-21T10:43:55.003000+08:00 [debug] 127.0.0.1:1231 [Channel] RECV CONNECT(Q0, R0, D0, ClientId=robots, ProtoName=MQTT, ProtoVsn=4, CleanStart=true, KeepAlive=60, Username=undefined, Password=undefined)
2023-06-21T10:43:55.003000+08:00 [debug] 127.0.0.1:1231 client_id: <<"robots">>
msg: insert_channel_info
2023-06-21T10:43:55.003000+08:00 [debug] 127.0.0.1:1231 [MQTT] SEND CONNACK(Q0, R0, D0, AckFlags=0, ReasonCode=0)
2023-06-21T10:43:55.003000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<130,15,0,1,0,10,97,108,108,111,99,97,116,105,111,110,0>>
2023-06-21T10:43:55.003000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV SUBSCRIBE(Q1, R0, D0, PacketId=1, TopicFilters=[{<<"allocation">>,#{nl => 0,qos => 0,rap => 0,rh => 0}}])
2023-06-21T10:43:55.003000+08:00 [info] 127.0.0.1:1231 robots SUBSCRIBE allocation: Options: #{nl => 0,qos => 0,rap => 0,rh => 0,sub_props => #{}}
2023-06-21T10:43:55.003000+08:00 [debug] 127.0.0.1:1231 [MQTT] SEND SUBACK(Q0, R0, D0, PacketId=1, ReasonCodes=[0])
2023-06-21T10:43:56.748000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.748000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.748000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>
2023-06-21T10:43:56.758000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.758000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.758000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>
2023-06-21T10:43:56.758000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.758000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.758000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>
2023-06-21T10:43:56.758000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.758000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.758000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>
2023-06-21T10:43:56.768000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.768000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.768000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>
2023-06-21T10:43:56.768000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.768000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.768000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>
2023-06-21T10:43:56.768000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.768000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.768000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>
2023-06-21T10:43:56.768000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.768000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.768000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>
2023-06-21T10:43:56.768000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.768000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.768000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>
2023-06-21T10:43:56.778000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.778000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.778000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>
2023-06-21T10:43:56.778000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.778000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.778000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>
2023-06-21T10:43:56.778000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.778000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.778000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>
2023-06-21T10:43:56.778000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.788000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.788000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>
2023-06-21T10:43:56.788000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV <<48,84,0,12,114,111,98,111,116,115,95,115,116,97,116,101,123,34,120,34,58,91,91,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,44,49,46,54,53,93,44,91,45,49,44,45,48,46,53,44,48,44,48,46,53,44,49,93,44,91,48,44,48,44,48,44,48,44,48,93,93,44,34,116,34,58,48,125>>
2023-06-21T10:43:56.788000+08:00 [debug] 127.0.0.1:1231 [MQTT] RECV PUBLISH(Q0, R0, D0, Topic=robots_state, PacketId=undefined, Payload=<<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>)
2023-06-21T10:43:56.788000+08:00 [info] 127.0.0.1:1231 PUBLISH to robots_state: <<"{\"x\":[[1.65,1.65,1.65,1.65,1.65],[-1,-0.5,0,0.5,1],[0,0,0,0,0]],\"t\":0}">>