5.0.26版本5.7W连接数以后客户端连接速度变慢

5.0.26版本5.7W连接数以后客户端连接速度变慢,dashboard和日志报错见附件
2025-10-27T01:31:40.438893+00:00 [error] crasher: initial call: emqx_connection:init/4, pid: <0.26634.2009>, registered_name: , error: {frame_serialize_error,[{emqx_connection,‘-serialize_and_inc_stats_fun/1-fun-0-’,2,[{file,“emqx_connection.erl”},{line,887}]},{lists,map,2,[{file,“lists.erl”},{line,1243}]},{emqx_connection,handle_outgoing,2,[{file,“emqx_connection.erl”},{line,852}]},{emqx_connection,process_msg,2,[{file,“emqx_connection.erl”},{line,485}]},{emqx_connection,process_msg,2,[{file,“emqx_connection.erl”},{line,491}]},{emqx_connection,handle_recv,3,[{file,“emqx_connection.erl”},{line,447}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,236}]}]}, ancestors: [<0.2352.0>,<0.2351.0>,esockd_sup,<0.1989.0>], message_queue_len: 0, messages: , links: [<0.2352.0>], dictionary: [{‘send_msg.qos0’,178299},{send_pkt,178867},{{publish,<<“/WS_WEX7_Charge/WS2322210G244100228/user/get”>>},{allow,1761528700413}},{authz_cache_size,32},{‘recv_msg.qos0’,95388},{recv_msg,95388},{{publish,<<“/WS_WEL7S_Charge/WS2322411G251200466/user/get”>>},{allow,1761528700405}},{outgoing_bytes,5279},{recv_pkt,95956},{{publish,<<“/WS_WEL7S_Charge/WS2322414G253810077/user/get”>>},{allow,1761528700399}},{outgoing_pubs,58},{{publish,<<“/WS_T40S_Charge/WS1311834G245000041/user/get”>>},{allow,1761528700413}},{{publish,<<“/WS_WEL7S_Charge/WS2322411G253010890/user/get”>>},{allow,1761528700433}},{{publish,<<“/WS_WEL7S_Charge/WS2322414G252300732/user/get”>>},{allow,1761528700405}},{{publish,<<“/WS_WEL7S_Charge/WS2322411G252601066/user/get”>>},{allow,1761528700409}},{{publish,<<“/WS_WEX7_Charge/WS2322210G241900943/user/get”>>},{allow,1761528700427}},{{publish,<<“/WS_WEL7C_Charge/WS2322412G251800431/user/get”>>},{allow,1761528700435}},{{publish,<<“/WS_A7C_Charge/WS2321602G245200355/user/get”>>},{allow,1761528700436}},{{publish,<<“/WS_T60NeoS_Charge/WS1312501G253310204/user/get”>>},{allow,1761528700427}},{{publish,<<“/WS_WEL7S_Charge/WS2322411G252200079/user/get”>>},{allow,1761528700413}},{{publish,<<“/NS_3.5KW_Charge/NS1321770G235100167/user/get”>>},{allow,1761528700434}},{{publish,<<“/WS_WEL7S_Charge/WS2322411G252711858/user/get”>>},{allow,1761528700407}},{{publish,<<“/WS_T40S_Charge/WS1311834G244600049/user/get”>>},{allow,1761528700411}},{{publish,<<“/WS_HQ22S_Charge/WS1312152G250800348/user/get”>>},{allow,1761528700436}},{incoming_bytes,3740},{{publish,<<“/NS_3.5KW_Charge/NS1321770G234300128/user/get”>>},{allow,1761528700400}},{{publish,<<“/WS_WEX7_Charge/WS2322210G241900929/user/get”>>},{allow,1761528700410}},{{publish,<<“/NS_3.5KW_Charge/NS1321770G233000141/user/get”>>},{allow,1761528700431}},{{publish,<<“/WS_T40NeoS_Charge/WS1312542G251900025/user/get”>>},{allow,1761528700432}},{guid,{1761528700436436,222551666550794,29853}},{{publish,<<“/WS_WEL7S_Charge/WS2322411G251200512/user/get”>>},{allow,1761528700403}},{{publish,<<“/NS_3.5KW_Charge/NS1321770G235100182/user/get”>>},{allow,1761528700434}},{{publish,<<“/WS_WEL7S_Charge/WS2322411G252600764/user/get”>>},{allow,1761528700409}},{{publish,<<“/WS_WEL7S_Charge/WS2322411G252800001/user/get”>>},{allow,1761528700411}},{‘$logger_metadata$’,#{clientid => <<“server:product:HKIQVOLL31WG48AGT4WHQ3EY”>>,peername => “10.42.3.113:60310”}},{{publish,<<“/WS_WEL7S_Charge/WS2322411G252202135/user/get”>>},{allow,1761528700418}},{{publish,<<“/WS_WEL7S_Charge/WS2322411G253913178/user/get”>>},{allow,1761528700431}},{incoming_pubs,57},{{publish,<<“/WS_WEL7S_Charge/WS2322411G252201104/user/get”>>},{allow,1761528700398}},{{publish,<<“/NS_3.5KW_Charge/NS1321770G232800157/user/get”>>},{allow,1761528700429}},{{publish,<<“/WS_WEX7_Charge/WS2322210G241900686/user/get”>>},{allow,1761528700425}},{{publish,<<“/WS_WEL7S_Charge/WS2322411G252400483/user/get”>>},{allow,1761528700399}},{authz_keys_q,{[{publish,<<“/WS_HQ22S_Charge/WS1312152G250800348/user/get”>>},{publish,<<“/WS_A7C_Charge/WS2321602G245200355/user/get”>>},{publish,<<“/WS_WEL7C_Charge/WS2322412G251800431/user/get”>>},{publish,<<“/NS_3.5KW_Charge/NS1321770G235100182/user/get”>>},{publish,<<“/NS_3.5KW_Charge/NS1321770G235100167/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322411G253010890/user/get”>>},{publish,<<“/WS_T40NeoS_Charge/WS1312542G251900025/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322411G253110765/user/get”>>},{publish,<<“/NS_3.5KW_Charge/NS1321770G233000141/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322411G253913178/user/get”>>},{publish,<<“/NS_3.5KW_Charge/NS1321770G232800157/user/get”>>},{publish,<<“/WS_WEX7_Charge/WS2322210G241900943/user/get”>>},{publish,<<“/WS_T60NeoS_Charge/WS1312501G253310204/user/get”>>},{publish,<<“/WS_WEX7_Charge/WS2322210G241900686/user/get”>>},{publish,<<“/WS_WEL7ProS_Charge/WS2322411G253613906/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322411G252202135/user/get”>>},{publish,<<“/WS_WEX7_Charge/WS2322210G244100228/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322411G252200079/user/get”>>}],[{publish,<<“/WS_WEL7S_Charge/WS2322411G252201104/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322414G253810077/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322411G252400483/user/get”>>},{publish,<<“/NS_3.5KW_Charge/NS1321770G234300128/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322411G251200512/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322414G252300732/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322411G251200466/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322411G252711858/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322411G252601066/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322411G252600764/user/get”>>},{publish,<<“/WS_WEX7_Charge/WS2322210G241900929/user/get”>>},{publish,<<“/WS_T40S_Charge/WS1311834G244600049/user/get”>>},{publish,<<“/WS_WEL7S_Charge/WS2322411G252800001/user/get”>>},{publish,<<“/WS_T40S_Charge/WS1311834G245000041/user/get”>>}]}},{send_msg,178299},{{publish,<<“/WS_WEL7ProS_Charge/WS2322411G253613906/user/get”>>},{allow,1761528700420}},{{publish,<<“/WS_WEL7S_Charge/WS2322411G253110765/user/get”>>},{allow,1761528700432}}], trap_exit: false, status: running, heap_size: 6772, stack_size: 29, reductions: 253618442; neighbours:
2025-10-27T01:31:40.440866+00:00 [error] supervisor: ‘esockd_connection_sup - <0.2352.0>’, errorContext: connection_crashed, reason: {frame_serialize_error,[{emqx_connection,‘-serialize_and_inc_stats_fun/1-fun-0-’,2,[{file,“emqx_connection.erl”},{line,887}]},{lists,map,2,[{file,“lists.erl”},{line,1243}]},{emqx_connection,handle_outgoing,2,[{file,“emqx_connection.erl”},{line,852}]},{emqx_connection,process_msg,2,[{file,“emqx_connection.erl”},{line,485}]},{emqx_connection,process_msg,2,[{file,“emqx_connection.erl”},{line,491}]},{emqx_connection,handle_recv,3,[{file,“emqx_connection.erl”},{line,447}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,236}]}]}, offender: [{pid,<0.5515.1995>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => #{connection => #{burst => 0,initial => 0,rate => 20.0}},listener => {tcp,default},zone => default}]}}]

这个是应该有不合法的 MQTT 包传过来,导致 EMQX 解析不出来,就 crash 了。
你再看这条日志前面一点点,应该还有一个 error:
关键字是:input_packet ,可以看到这个包长什么样子。

  1. retainer 的 crash 是 bug。在最新版本已经修复过了。

您提到的retainer的crash这个问题会影响连接性能吗,我在dashborad发现了另一个告警是connection congested: #{buffer => 4096,clientid => <<“server:product:GWQERFDQ7LRS10ROS2O4306V”>>,conn_state => connected,connected_at => 1760725640183,high_msgq_watermark => 8192,high_watermark => 1048576,memory => 47464,message_queue_len => 0,peername => <<“10.42.6.71:49052”>>,pid => <<“<0.13158.1476>”>>,proto_name => <<“MQTT”>>,proto_ver => 4,recbuf => 131072,recv_cnt => 3,recv_oct => 150,reductions => 149699,send_cnt => 281,send_oct => 27688,send_pend => 356,sndbuf => 87040,sockname => <<“10.42.0.86:1883”>>,socktype => tcp,username => <<“server”>>}

有时会,连接时订阅后会把保留消息(retainer)发给客户端。
这个 retainer 模块直接 crash 掉了。讲道理,应该是这个客户端会直接掉线的,和你描述的连接速率变慢好像不太符合,麻烦你再确认一下是连不上,还是连接变慢。。。

保留消息的功能我已经在dashborad关掉了,依旧会有这个错误存在吗

会,就是你关了才有这个错的。
如果你没有用到保留消息这个功能 ,还不如直接打开他,没什么影响。

设备那边会因为干扰原因把保留消息错误的打开导致一些业务上的错误,我进行版本更新的话会导致所有客户端连接断开吗,有什么平滑升级的方案吗

没。
这是大版本升级了,升级前要自己先在测试环境做好测试