emqx时不时的断开连接

环境信息

  • EMQ X 版本:4.3.7
  • 操作系统及版本:centos7
  • 其他

问题描述

出现的频率感觉还挺高的

配置文件及日志

日志里面主要是这三个错误在循环

2021-10-22T03:10:02.991316+08:00 [error] 113.127.140.161:40668 [MQTT] , Parse failed for {badmatch,{#{},<<"rams\":{\"RFID_Data\":48},\"version\"">>}}, [{emqx_frame,parse_packet,3,[{file,"emqx_frame.erl"},{line,239}]},{emqx_frame,parse_frame,4,[{file,"emqx_frame.erl"},{line,181}]},{emqx_connection,parse_incoming,3,[{file,"emqx_connection.erl"},{line,625}]},{emqx_connection,handle_msg,2,[{file,"emqx_connection.erl"},{line,618}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,364}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,328}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,236}]}], Frame data:<<",\"params\":{\"RFID_Data\":48},\"version\":\"1.0.0\"}0"...>>
2021-10-22T03:10:02.994055+08:00 [error] supervisor: 'esockd_connection_sup - <0.1812.0>', errorContext: connection_shutdown, reason: {badmatch,{#{},<<"rams\":{\"RFID_Data\":48},\"version\"">>}}, offender: [{pid,<0.19971.164>},{name,connection},{mfargs,{emqx_connection,start_link,[[{deflate_options,[]},{max_conn_rate,1000},{active_n,100},{zone,external},{proxy_address_header,<<>>},{proxy_port_header,<<>>},{supported_subprotocols,[]}]]}}]
2021-10-22T03:10:03.125015+08:00 [error] 113.127.140.161:40428 [MQTT] , Parse failed for function_clause, [{emqx_frame,parse_packet,[{mqtt_packet_header,7,false,2,false},<<"\",\"id\":{\"IMEI_Data\":861213052240295},\"params\":{\"RFID"...>>,#{max_size => 1048576,strict_mode => false,version => 4}],[{file,"emqx_frame.erl"},{line,204}]},{emqx_frame,parse_frame,4,[{file,"emqx_frame.erl"},{line,181}]},{emqx_connection,parse_incoming,3,[{file,"emqx_connection.erl"},{line,625}]},{emqx_connection,handle_msg,2,[{file,"emqx_connection.erl"},{line,618}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,364}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,328}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,236}]}], Frame data:<<"ta\",\"id\":{\"IMEI_Data\":861213052240295},\"params\":{\"RFID_Data\":1},\"version\":\"1"...>>
1赞

你的组包出了问题,看下终端侧的 MQTT 协议栈实现。

意思是发送的mqtt报文格式有问题吗

是的,解包的时候出现的格式错误,应该是缺少字段导致的

明白了,谢谢