某个客户端意外断开连接,其它客户端正常

环境

  • EMQX 版本:5.0.16
  • 操作系统版本:Linux

重现此问题的步骤

  1. 服务端某个消费客户端smart-city_in连接上mqtt后,一段时间后会异常断开,并且不会自动重新连接。其它客户端正常连接。

预期行为

客户端不应该异常断开连接

实际行为

服务端disconnected断开连接日志:

MQTT 客户端断开连接:Timed out waiting for a response from the server

EMQX日志:

2024-10-31T23:05:37.285989+08:00 [error] msg: unexpected_sock_close, mfa: emqx_channel:handle_info/2, line: 1266, peername: 11.1.71.184:54371, clientid: TISE0401001202208184476, reason: tcp_closed
2024-10-31T23:29:23.333603+08:00 [error] mfa: emqx_connection:serialize_and_inc_stats_fun/1, line: 854, peername: 10.111.55.70:38950, clientid: smart-city_in, exception: badarg, input_packet: {mqtt_packet,{mqtt_packet_header,3,false,0,false},{mqtt_packet_publish,<<36,83,89,83,47,98,114,111,107,101,114,115,47,101,109,113,120,64,49,50,55,46,48,46,48,46,49,47,99,108,105,101,110,116,115,47,84,73,83,69,48,52,48,49,48,48,49,50,48,50,153,48,56,49,56,52,49,49,56,47,99,111,110,110,101,99,116,101,100>>,undefined,#{}},<<"{\"username\":\"smartcity\",\"ts\":1730388563333,\"sockport\":31883,\"protocol\":\"mqtt\",\"proto_ver\":3,\"proto_name\":\"MQIsdp\",\"keepalive\":120,\"ipaddress\":\"11.1.55.197\",\"expiry_interval\":0,\"connected_at\":1730388563333,\"clientid\":\"TISE0401001202"...>>}, stacktrace: [{erlang,byte_size,[{error,<<"$SYS/brokers/emqx@127.0.0.1/clients/TISE0401001202">>,<<153,48,56,49,56,52,49,49,56,47,99,111,110,110,101,99,116,101,100>>}],[{error_info,#{module => erl_erts_errors}}]},{emqx_frame,serialize_utf8_string,1,[{file,"emqx_frame.erl"},{line,1053}]},{emqx_frame,serialize_variable,2,[{file,"emqx_frame.erl"},{line,830}]},{emqx_frame,serialize,2,[{file,"emqx_frame.erl"},{line,739}]},{emqx_frame,serialize_pkt,2,[{file,"emqx_frame.erl"},{line,721}]},{emqx_connection,'-serialize_and_inc_stats_fun/1-fun-0-',2,[{file,"emqx_connection.erl"},{line,826}]},{lists,map,2,[{file,"lists.erl"},{line,1243}]},{emqx_connection,handle_outgoing,2,[{file,"emqx_connection.erl"},{line,820}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,471}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,477}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,433}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,236}]}]
2024-10-31T23:29:23.336166+08:00 [error] REPORT_CB/2 CRASH: [{mfa,["proc_lib",":","crash_report","/4"]},{line,525},{peername,"10.111.55.70:38950"},{clientid,"smart-city_in"},{label,{proc_lib,crash}},{report,[[{initial_call,{emqx_connection,init,['Argument__1','Argument__2','Argument__3','Argument__4']}},{pid,<0.2504.0>},{registered_name,[]},{error_info,{error,frame_serialize_error,[{emqx_connection,'-serialize_and_inc_stats_fun/1-fun-0-',2,[{file,"emqx_connection.erl"},{line,855}]},{lists,map,2,[{file,"lists.erl"},{line,1243}]},{emqx_connection,handle_outgoing,2,[{file,"emqx_connection.erl"},{line,820}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,471}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,477}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,433}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,236}]}]}},{ancestors,[<0.2220.0>,<0.2219.0>,esockd_sup,<0.1922.0>]},{message_queue_len,0},{messages,[]},{links,[<0.2220.0>]},{dictionary,[{{subscribe,<<"/smartCity/+/+/vttu/date">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/service/+/reply">>},{allow,1730368087584}},{{subscribe,<<"smartCity/cpu">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/service/+">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/service/params/get_reply">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/group/network/set_reply">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/group/ability/update">>},{allow,1730368087584}},{{subscribe,<<"smartCity/Analog">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/+/dev/data">>},{allow,1730368087584}},{{subscribe,<<"wsn/sink/001">>},{allow,1730368087584}},{{subscribe,<<"simulation/#">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/ota/download">>},{allow,1730368087584}},{authz_keys_q,{[{subscribe,<<"$SYS/brokers/+/clients/+/+">>},{subscribe,<<"/smartCity/+/+/vttu/date">>},{subscribe,<<"smartCity/+/+/dev/data">>},{subscribe,<<"smartCity/sensor/#">>},{subscribe,<<"simulation/#">>},{subscribe,<<"smartCity/deviceReply/#">>},{subscribe,<<"smartCity/terminalData">>},{subscribe,<<"smartCity/bit">>},{subscribe,<<"wsn/sink/001">>},{subscribe,<<"smartCity/cpu">>},{subscribe,<<"smartCity/Analog">>},{subscribe,<<"smartCity/sim">>},{subscribe,<<"smartCity/wire">>},{subscribe,<<"smartCity/energy">>},{subscribe,<<"smartCity/environment">>},{subscribe,<<"smartCity/+/dev/data">>},{subscribe,<<"smartCity/+/thing/deviceInfo/update">>},{subscribe,<<"smartCity/+/thing/service/+/reply">>},{subscribe,<<"smartCity/+/thing/service/+">>},{subscribe,<<"smartCity/+/thing/group/network/taskUpdate">>},{subscribe,<<"smartCity/+/thing/group/network/update">>},{subscribe,<<"smartCity/+/thing/group/ability/update">>},{subscribe,<<"smartCity/+/thing/group/network/set_reply">>},{subscribe,<<"smartCity/+/thing/ota/download">>},{subscribe,<<"smartCity/+/thing/ota/start_reply">>},{subscribe,<<"smartCity/+/thing/service/params/get_reply">>},{subscribe,<<"smartCity/+/thing/service/params/get">>},{subscribe,<<"smartCity/+/thing/service/params/delete_reply">>}],[{subscribe,<<"smartCity/+/thing/event/+/post">>},{subscribe,<<"ydcn/+/thing/event/+/post">>},{subscribe,<<"smartCity/+/thing/service/property/set_reply">>},{subscribe,<<"smartCity/+/thing/service/params/set_reply">>}]}},{{subscribe,<<"smartCity/terminalData">>},{allow,1730368087584}},{{subscribe,<<"smartCity/environment">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/dev/data">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/service/params/set_reply">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/event/+/post">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/deviceInfo/update">>},{allow,1730368087584}},{incoming_bytes,340},{guid,{1730368087579602,268564305021384,1}},{{subscribe,<<"smartCity/deviceReply/#">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/group/network/taskUpdate">>},{allow,1730368087584}},{send_msg,996515},{{subscribe,<<"$SYS/brokers/+/clients/+/+">>},{allow,1730368087584}},{{subscribe,<<"smartCity/sim">>},{allow,1730368087584}},{incoming_pubs,0},{recv_pkt,983290},{'$logger_metadata$',#{clientid => <<"smart-city_in">>,peername => "10.111.55.70:38950"}},{{subscribe,<<"ydcn/+/thing/event/+/post">>},{allow,1730368087584}},{{subscribe,<<"smartCity/sensor/#">>},{allow,1730368087584}},{{subscribe,<<"smartCity/energy">>},{allow,1730368087584}},{authz_cache_size,32},{{subscribe,<<"smartCity/+/thing/service/params/get">>},{allow,1730368087584}},{'send_msg.qos0',13232},{{subscribe,<<"smartCity/+/thing/ota/start_reply">>},{allow,1730368087584}},{outgoing_bytes,33476},{'send_msg.qos1',983283},{outgoing_pubs,90},{send_pkt,996522},{{subscribe,<<"smartCity/wire">>},{allow,1730368087584}},{{subscribe,<<"smartCity/bit">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/service/params/delete_reply">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/group/network/update">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/service/property/set_reply">>},{allow,1730368087584}}]},{trap_exit,false},{status,running},{heap_size,17731},{stack_size,29},{reductions,917097027}],[]]}]; Reason: {error,function_clause,[{proc_lib,report_cb,[[{mfa,["proc_lib",":","crash_report","/4"]},{line,525},{peername,"10.111.55.70:38950"},{clientid,"smart-city_in"},{label,{proc_lib,crash}},{report,[[{initial_call,{emqx_connection,init,['Argument__1','Argument__2','Argument__3','Argument__4']}},{pid,<0.2504.0>},{registered_name,[]},{error_info,{error,frame_serialize_error,[{emqx_connection,'-serialize_and_inc_stats_fun/1-fun-0-',2,[{file,"emqx_connection.erl"},{line,855}]},{lists,map,2,[{file,"lists.erl"},{line,1243}]},{emqx_connection,handle_outgoing,2,[{file,"emqx_connection.erl"},{line,820}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,471}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,477}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,433}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,236}]}]}},{ancestors,[<0.2220.0>,<0.2219.0>,esockd_sup,<0.1922.0>]},{message_queue_len,0},{messages,[]},{links,[<0.2220.0>]},{dictionary,[{{subscribe,<<"/smartCity/+/+/vttu/date">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/service/+/reply">>},{allow,1730368087584}},{{subscribe,<<"smartCity/cpu">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/service/+">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/service/params/get_reply">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/group/network/set_reply">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/group/ability/update">>},{allow,1730368087584}},{{subscribe,<<"smartCity/Analog">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/+/dev/data">>},{allow,1730368087584}},{{subscribe,<<"wsn/sink/001">>},{allow,1730368087584}},{{subscribe,<<"simulation/#">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/ota/download">>},{allow,1730368087584}},{authz_keys_q,{[{subscribe,<<"$SYS/brokers/+/clients/+/+">>},{subscribe,<<"/smartCity/+/+/vttu/date">>},{subscribe,<<"smartCity/+/+/dev/data">>},{subscribe,<<"smartCity/sensor/#">>},{subscribe,<<"simulation/#">>},{subscribe,<<"smartCity/deviceReply/#">>},{subscribe,<<"smartCity/terminalData">>},{subscribe,<<"smartCity/bit">>},{subscribe,<<"wsn/sink/001">>},{subscribe,<<"smartCity/cpu">>},{subscribe,<<"smartCity/Analog">>},{subscribe,<<"smartCity/sim">>},{subscribe,<<"smartCity/wire">>},{subscribe,<<"smartCity/energy">>},{subscribe,<<"smartCity/environment">>},{subscribe,<<"smartCity/+/dev/data">>},{subscribe,<<"smartCity/+/thing/deviceInfo/update">>},{subscribe,<<"smartCity/+/thing/service/+/reply">>},{subscribe,<<"smartCity/+/thing/service/+">>},{subscribe,<<"smartCity/+/thing/group/network/taskUpdate">>},{subscribe,<<"smartCity/+/thing/group/network/update">>},{subscribe,<<"smartCity/+/thing/group/ability/update">>},{subscribe,<<"smartCity/+/thing/group/network/set_reply">>},{subscribe,<<"smartCity/+/thing/ota/download">>},{subscribe,<<"smartCity/+/thing/ota/start_reply">>},{subscribe,<<"smartCity/+/thing/service/params/get_reply">>},{subscribe,<<"smartCity/+/thing/service/params/get">>},{subscribe,<<"smartCity/+/thing/service/params/delete_reply">>}],[{subscribe,<<"smartCity/+/thing/event/+/post">>},{subscribe,<<"ydcn/+/thing/event/+/post">>},{subscribe,<<"smartCity/+/thing/service/property/set_reply">>},{subscribe,<<"smartCity/+/thing/service/params/set_reply">>}]}},{{subscribe,<<"smartCity/terminalData">>},{allow,1730368087584}},{{subscribe,<<"smartCity/environment">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/dev/data">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/service/params/set_reply">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/event/+/post">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/deviceInfo/update">>},{allow,1730368087584}},{incoming_bytes,340},{guid,{1730368087579602,268564305021384,1}},{{subscribe,<<"smartCity/deviceReply/#">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/group/network/taskUpdate">>},{allow,1730368087584}},{send_msg,996515},{{subscribe,<<"$SYS/brokers/+/clients/+/+">>},{allow,1730368087584}},{{subscribe,<<"smartCity/sim">>},{allow,1730368087584}},{incoming_pubs,0},{recv_pkt,983290},{'$logger_metadata$',#{clientid => <<"smart-city_in">>,peername => "10.111.55.70:38950"}},{{subscribe,<<"ydcn/+/thing/event/+/post">>},{allow,1730368087584}},{{subscribe,<<"smartCity/sensor/#">>},{allow,1730368087584}},{{subscribe,<<"smartCity/energy">>},{allow,1730368087584}},{authz_cache_size,32},{{subscribe,<<"smartCity/+/thing/service/params/get">>},{allow,1730368087584}},{'send_msg.qos0',13232},{{subscribe,<<"smartCity/+/thing/ota/start_reply">>},{allow,1730368087584}},{outgoing_bytes,33476},{'send_msg.qos1',983283},{outgoing_pubs,90},{send_pkt,996522},{{subscribe,<<"smartCity/wire">>},{allow,1730368087584}},{{subscribe,<<"smartCity/bit">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/service/params/delete_reply">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/group/network/update">>},{allow,1730368087584}},{{subscribe,<<"smartCity/+/thing/service/property/set_reply">>},{allow,1730368087584}}]},{trap_exit,false},{status,running},{heap_size,17731},{stack_size,29},{reductions,917097027}],[]]}],#{chars_limit => unlimited,depth => 100,single_line => true}],[{file,"proc_lib.erl"},{line,774}]}]}
2024-10-31T23:29:23.339262+08:00 [error] label: {error_logger,error_report}, report: [{supervisor,'esockd_connection_sup - <0.2220.0>'},{errorContext,connection_crashed},{reason,{frame_serialize_error,[{emqx_connection,'-serialize_and_inc_stats_fun/1-fun-0-',2,[{file,"emqx_connection.erl"},{line,855}]},{lists,map,2,[{file,"lists.erl"},{line,1243}]},{emqx_connection,handle_outgoing,2,[{file,"emqx_connection.erl"},{line,820}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,471}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,477}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,433}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,236}]}]}},{offender,[{pid,<0.2504.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => #{bytes_in => #{capacity => 1099511627776,initial => 0,rate => infinity},client => #{bytes_in => #{capacity => 1099511627776,divisible => false,failure_strategy => force,initial => 0,low_watermark => 0,max_retry_time => 10000,rate => infinity},connection => #{capacity => 1099511627776,divisible => false,failure_strategy => force,initial => 0,low_watermark => 0,max_retry_time => 10000,rate => infinity},message_in => #{capacity => 1099511627776,divisible => false,failure_strategy => force,initial => 0,low_watermark => 0,max_retry_time => 10000,rate => infinity},message_routing => #{capacity => 1099511627776,divisible => false,failure_strategy => force,initial => 0,low_watermark => 0,max_retry_time => 10000,rate => infinity}},connection => #{capacity => 1000,initial => 0,rate => 100.0},message_in => #{capacity => 1099511627776,initial => 0,rate => infinity},message_routing => #{capacity => 1099511627776,initial => 0,rate => infinity}},listener => {tcp,default},zone => default}]}}]}]
2024-10-31T23:45:53.344375+08:00 [error] mfa: emqx_connection:serialize_and_inc_stats_fun/1, line: 854, peername: 10.111.55.70:50650, clientid: smart-city_in, exception: badarg, input_packet: {mqtt_packet,{mqtt_packet_header,3,false,0,false},{mqtt_packet_publish,<<36,83,89,83,47,98,114,111,107,101,114,115,47,101,109,113,120,64,49,50,55,46,48,46,48,46,49,47,99,108,105,101,110,116,115,47,84,73,83,69,48,52,48,49,48,48,49,50,48,50,153,48,56,49,56,52,49,49,56,47,100,105,115,99,111,110,110,101,99,116,101,100>>,undefined,#{}},<<"{\"username\":\"smartcity\",\"ts\":1730389553343,\"sockport\":31883,\"reason\":\"keepalive_timeout\",\"protocol\":\"mqtt\",\"proto_ver\":3,\"proto_name\":\"MQIsdp\",\"ipaddress\":\"11.1.55.197\",\"disconnected_at\":1730389553343,\"connected_at\":1730388563333,\"clientid\":\"TISE0401001202"...>>}, stacktrace: [{erlang,byte_size,[{error,<<"$SYS/brokers/emqx@127.0.0.1/clients/TISE0401001202">>,<<153,48,56,49,56,52,49,49,56,47,100,105,115,99,111,110,110,101,99,116,101,100>>}],[{error_info,#{module => erl_erts_errors}}]},{emqx_frame,serialize_utf8_string,1,[{file,"emqx_frame.erl"},{line,1053}]},{emqx_frame,serialize_variable,2,[{file,"emqx_frame.erl"},{line,830}]},{emqx_frame,serialize,2,[{file,"emqx_frame.erl"},{line,739}]},{emqx_frame,serialize_pkt,2,[{file,"emqx_frame.erl"},{line,721}]},{emqx_connection,'-serialize_and_inc_stats_fun/1-fun-0-',2,[{file,"emqx_connection.erl"},{line,826}]},{lists,map,2,[{file,"lists.erl"},{line,1243}]},{emqx_connection,handle_outgoing,2,[{file,"emqx_connection.erl"},{line,820}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,471}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,477}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,433}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,236}]}]
2024-10-31T23:45:53.345711+08:00 [error] REPORT_CB/2 CRASH: [{mfa,["proc_lib",":","crash_report","/4"]},{line,525},{peername,"10.111.55.70:50650"},{clientid,"smart-city_in"},{label,{proc_lib,crash}},{report,[[{initial_call,{emqx_connection,init,['Argument__1','Argument__2','Argument__3','Argument__4']}},{pid,<0.4813.2>},{registered_name,[]},{error_info,{error,frame_serialize_error,[{emqx_connection,'-serialize_and_inc_stats_fun/1-fun-0-',2,[{file,"emqx_connection.erl"},{line,855}]},{lists,map,2,[{file,"lists.erl"},{line,1243}]},{emqx_connection,handle_outgoing,2,[{file,"emqx_connection.erl"},{line,820}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,471}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,477}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,433}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,236}]}]}},{ancestors,[<0.2220.0>,<0.2219.0>,esockd_sup,<0.1922.0>]},{message_queue_len,1},{messages,[{tcp,#Port<0.8815>,<<64,2,182,173>>}]},{links,[<0.2220.0>]},{dictionary,[{{subscribe,<<"/smartCity/+/+/vttu/date">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/service/+/reply">>},{allow,1730388564649}},{{subscribe,<<"smartCity/cpu">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/service/+">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/service/params/get_reply">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/group/network/set_reply">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/group/ability/update">>},{allow,1730388564649}},{{subscribe,<<"smartCity/Analog">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/+/dev/data">>},{allow,1730388564649}},{{subscribe,<<"wsn/sink/001">>},{allow,1730388564649}},{{subscribe,<<"simulation/#">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/ota/download">>},{allow,1730388564649}},{authz_keys_q,{[{subscribe,<<"$SYS/brokers/+/clients/+/+">>},{subscribe,<<"/smartCity/+/+/vttu/date">>},{subscribe,<<"smartCity/+/+/dev/data">>},{subscribe,<<"smartCity/sensor/#">>},{subscribe,<<"simulation/#">>},{subscribe,<<"smartCity/deviceReply/#">>},{subscribe,<<"smartCity/terminalData">>},{subscribe,<<"smartCity/bit">>},{subscribe,<<"wsn/sink/001">>},{subscribe,<<"smartCity/cpu">>},{subscribe,<<"smartCity/Analog">>},{subscribe,<<"smartCity/sim">>},{subscribe,<<"smartCity/wire">>},{subscribe,<<"smartCity/energy">>},{subscribe,<<"smartCity/environment">>},{subscribe,<<"smartCity/+/dev/data">>},{subscribe,<<"smartCity/+/thing/deviceInfo/update">>},{subscribe,<<"smartCity/+/thing/service/+/reply">>},{subscribe,<<"smartCity/+/thing/service/+">>},{subscribe,<<"smartCity/+/thing/group/network/taskUpdate">>},{subscribe,<<"smartCity/+/thing/group/network/update">>},{subscribe,<<"smartCity/+/thing/group/ability/update">>},{subscribe,<<"smartCity/+/thing/group/network/set_reply">>},{subscribe,<<"smartCity/+/thing/ota/download">>},{subscribe,<<"smartCity/+/thing/ota/start_reply">>},{subscribe,<<"smartCity/+/thing/service/params/get_reply">>},{subscribe,<<"smartCity/+/thing/service/params/get">>},{subscribe,<<"smartCity/+/thing/service/params/delete_reply">>}],[{subscribe,<<"smartCity/+/thing/event/+/post">>},{subscribe,<<"ydcn/+/thing/event/+/post">>},{subscribe,<<"smartCity/+/thing/service/property/set_reply">>},{subscribe,<<"smartCity/+/thing/service/params/set_reply">>}]}},{{subscribe,<<"smartCity/terminalData">>},{allow,1730388564649}},{{subscribe,<<"smartCity/environment">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/dev/data">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/service/params/set_reply">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/event/+/post">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/deviceInfo/update">>},{allow,1730388564649}},{incoming_bytes,128},{guid,{1730388564644146,268564338578125,1}},{{subscribe,<<"smartCity/deviceReply/#">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/group/network/taskUpdate">>},{allow,1730388564649}},{send_msg,47165},{{subscribe,<<"$SYS/brokers/+/clients/+/+">>},{allow,1730388564649}},{{subscribe,<<"smartCity/sim">>},{allow,1730388564649}},{incoming_pubs,0},{recv_pkt,46766},{'$logger_metadata$',#{clientid => <<"smart-city_in">>,peername => "10.111.55.70:50650"}},{{subscribe,<<"ydcn/+/thing/event/+/post">>},{allow,1730388564649}},{{subscribe,<<"smartCity/sensor/#">>},{allow,1730388564649}},{{subscribe,<<"smartCity/energy">>},{allow,1730388564649}},{authz_cache_size,32},{{subscribe,<<"smartCity/+/thing/service/params/get">>},{allow,1730388564649}},{'send_msg.qos0',400},{{subscribe,<<"smartCity/+/thing/ota/start_reply">>},{allow,1730388564649}},{outgoing_bytes,36887},{'send_msg.qos1',46765},{outgoing_pubs,98},{send_pkt,47167},{{subscribe,<<"smartCity/wire">>},{allow,1730388564649}},{{subscribe,<<"smartCity/bit">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/service/params/delete_reply">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/group/network/update">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/service/property/set_reply">>},{allow,1730388564649}}]},{trap_exit,false},{status,running},{heap_size,10958},{stack_size,29},{reductions,43591306}],[]]}]; Reason: {error,function_clause,[{proc_lib,report_cb,[[{mfa,["proc_lib",":","crash_report","/4"]},{line,525},{peername,"10.111.55.70:50650"},{clientid,"smart-city_in"},{label,{proc_lib,crash}},{report,[[{initial_call,{emqx_connection,init,['Argument__1','Argument__2','Argument__3','Argument__4']}},{pid,<0.4813.2>},{registered_name,[]},{error_info,{error,frame_serialize_error,[{emqx_connection,'-serialize_and_inc_stats_fun/1-fun-0-',2,[{file,"emqx_connection.erl"},{line,855}]},{lists,map,2,[{file,"lists.erl"},{line,1243}]},{emqx_connection,handle_outgoing,2,[{file,"emqx_connection.erl"},{line,820}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,471}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,477}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,433}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,236}]}]}},{ancestors,[<0.2220.0>,<0.2219.0>,esockd_sup,<0.1922.0>]},{message_queue_len,1},{messages,[{tcp,#Port<0.8815>,<<64,2,182,173>>}]},{links,[<0.2220.0>]},{dictionary,[{{subscribe,<<"/smartCity/+/+/vttu/date">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/service/+/reply">>},{allow,1730388564649}},{{subscribe,<<"smartCity/cpu">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/service/+">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/service/params/get_reply">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/group/network/set_reply">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/group/ability/update">>},{allow,1730388564649}},{{subscribe,<<"smartCity/Analog">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/+/dev/data">>},{allow,1730388564649}},{{subscribe,<<"wsn/sink/001">>},{allow,1730388564649}},{{subscribe,<<"simulation/#">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/ota/download">>},{allow,1730388564649}},{authz_keys_q,{[{subscribe,<<"$SYS/brokers/+/clients/+/+">>},{subscribe,<<"/smartCity/+/+/vttu/date">>},{subscribe,<<"smartCity/+/+/dev/data">>},{subscribe,<<"smartCity/sensor/#">>},{subscribe,<<"simulation/#">>},{subscribe,<<"smartCity/deviceReply/#">>},{subscribe,<<"smartCity/terminalData">>},{subscribe,<<"smartCity/bit">>},{subscribe,<<"wsn/sink/001">>},{subscribe,<<"smartCity/cpu">>},{subscribe,<<"smartCity/Analog">>},{subscribe,<<"smartCity/sim">>},{subscribe,<<"smartCity/wire">>},{subscribe,<<"smartCity/energy">>},{subscribe,<<"smartCity/environment">>},{subscribe,<<"smartCity/+/dev/data">>},{subscribe,<<"smartCity/+/thing/deviceInfo/update">>},{subscribe,<<"smartCity/+/thing/service/+/reply">>},{subscribe,<<"smartCity/+/thing/service/+">>},{subscribe,<<"smartCity/+/thing/group/network/taskUpdate">>},{subscribe,<<"smartCity/+/thing/group/network/update">>},{subscribe,<<"smartCity/+/thing/group/ability/update">>},{subscribe,<<"smartCity/+/thing/group/network/set_reply">>},{subscribe,<<"smartCity/+/thing/ota/download">>},{subscribe,<<"smartCity/+/thing/ota/start_reply">>},{subscribe,<<"smartCity/+/thing/service/params/get_reply">>},{subscribe,<<"smartCity/+/thing/service/params/get">>},{subscribe,<<"smartCity/+/thing/service/params/delete_reply">>}],[{subscribe,<<"smartCity/+/thing/event/+/post">>},{subscribe,<<"ydcn/+/thing/event/+/post">>},{subscribe,<<"smartCity/+/thing/service/property/set_reply">>},{subscribe,<<"smartCity/+/thing/service/params/set_reply">>}]}},{{subscribe,<<"smartCity/terminalData">>},{allow,1730388564649}},{{subscribe,<<"smartCity/environment">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/dev/data">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/service/params/set_reply">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/event/+/post">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/deviceInfo/update">>},{allow,1730388564649}},{incoming_bytes,128},{guid,{1730388564644146,268564338578125,1}},{{subscribe,<<"smartCity/deviceReply/#">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/group/network/taskUpdate">>},{allow,1730388564649}},{send_msg,47165},{{subscribe,<<"$SYS/brokers/+/clients/+/+">>},{allow,1730388564649}},{{subscribe,<<"smartCity/sim">>},{allow,1730388564649}},{incoming_pubs,0},{recv_pkt,46766},{'$logger_metadata$',#{clientid => <<"smart-city_in">>,peername => "10.111.55.70:50650"}},{{subscribe,<<"ydcn/+/thing/event/+/post">>},{allow,1730388564649}},{{subscribe,<<"smartCity/sensor/#">>},{allow,1730388564649}},{{subscribe,<<"smartCity/energy">>},{allow,1730388564649}},{authz_cache_size,32},{{subscribe,<<"smartCity/+/thing/service/params/get">>},{allow,1730388564649}},{'send_msg.qos0',400},{{subscribe,<<"smartCity/+/thing/ota/start_reply">>},{allow,1730388564649}},{outgoing_bytes,36887},{'send_msg.qos1',46765},{outgoing_pubs,98},{send_pkt,47167},{{subscribe,<<"smartCity/wire">>},{allow,1730388564649}},{{subscribe,<<"smartCity/bit">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/service/params/delete_reply">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/group/network/update">>},{allow,1730388564649}},{{subscribe,<<"smartCity/+/thing/service/property/set_reply">>},{allow,1730388564649}}]},{trap_exit,false},{status,running},{heap_size,10958},{stack_size,29},{reductions,43591306}],[]]}],#{chars_limit => unlimited,depth => 100,single_line => true}],[{file,"proc_lib.erl"},{line,774}]}]}
2024-10-31T23:45:53.348549+08:00 [error] label: {error_logger,error_report}, report: [{supervisor,'esockd_connection_sup - <0.2220.0>'},{errorContext,connection_crashed},{reason,{frame_serialize_error,[{emqx_connection,'-serialize_and_inc_stats_fun/1-fun-0-',2,[{file,"emqx_connection.erl"},{line,855}]},{lists,map,2,[{file,"lists.erl"},{line,1243}]},{emqx_connection,handle_outgoing,2,[{file,"emqx_connection.erl"},{line,820}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,471}]},{emqx_connection,process_msg,2,[{file,"emqx_connection.erl"},{line,477}]},{emqx_connection,handle_recv,3,[{file,"emqx_connection.erl"},{line,433}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,236}]}]}},{offender,[{pid,<0.4813.2>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => #{bytes_in => #{capacity => 1099511627776,initial => 0,rate => infinity},client => #{bytes_in => #{capacity => 1099511627776,divisible => false,failure_strategy => force,initial => 0,low_watermark => 0,max_retry_time => 10000,rate => infinity},connection => #{capacity => 1099511627776,divisible => false,failure_strategy => force,initial => 0,low_watermark => 0,max_retry_time => 10000,rate => infinity},message_in => #{capacity => 1099511627776,divisible => false,failure_strategy => force,initial => 0,low_watermark => 0,max_retry_time => 10000,rate => infinity},message_routing => #{capacity => 1099511627776,divisible => false,failure_strategy => force,initial => 0,low_watermark => 0,max_retry_time => 10000,rate => infinity}},connection => #{capacity => 1000,initial => 0,rate => 100.0},message_in => #{capacity => 1099511627776,initial => 0,rate => infinity},message_routing => #{capacity => 1099511627776,initial => 0,rate => infinity}},listener => {tcp,default},zone => default}]}}]}]
2024-11-01T00:15:44.469235+08:00 [error] msg: unexpected_sock_close, mfa: emqx_channel:handle_info/2, line: 1266, peername: 11.1.56.112:54371, clientid: TISE0401001202208184497, reason: tcp_closed
2024-11-01T01:09:19.201866+08:00 [error] Process:            <0.7457.2> on node 'emqx@127.0.0.1', Context:            maximum heap size reached, Max Heap Size:      6291456, Total Heap Size:    7047618, Kill:               true, Error Logger:       true, Message Queue Len:  0, GC Info:            [{old_heap_block_size,2487399},{heap_block_size,4560232},{mbuf_size,154},{recent_size,1549412},{stack_size,30},{old_heap_size,0},{heap_size,2072666},{bin_vheap_size,1074281},{bin_vheap_block_size,2094654},{bin_old_vheap_size,0},{bin_old_vheap_block_size,128690}]
2024-11-01T01:43:27.440079+08:00 [error] msg: unexpected_sock_close, mfa: emqx_channel:handle_info/2, line: 1266, peername: 11.1.72.98:54371, clientid: TISE0401001202208184486, reason: tcp_closed
2024-11-01T02:27:59.738801+08:00 [error] msg: unexpected_sock_close, mfa: emqx_channel:handle_info/2, line: 1266, peername: 11.1.72.104:54371, clientid: TISE0401001202208184465, reason: tcp_closed
2024-11-01T08:54:52.587120+08:00 [error] msg: unexpected_sock_close, mfa: emqx_channel:handle_info/2, line: 1266, peername: 11.1.71.220:54371, clientid: TISE0401001202208184454, reason: tcp_closed
2024-11-01T09:13:24.878616+08:00 [error] msg: unexpected_sock_close, mfa: emqx_channel:handle_info/2, line: 1266, peername: 11.1.90.201:54371, clientid: TISE0401001202208184429, reason: tcp_closed

https://github.com/emqx/emqx/pull/12944
已经在 5.8.1 上修复了这个 bug. 欢迎升级到最新版本 5.8.1
因为这个客户端订阅了上下线事件,当有非 utf8 的客户端连上来时,发出来的事件就影响到它。