环境
- EMQX 版本:5.0.23
- 操作系统版本:Linux iZgw8549xenvv5sgwo1uf0Z 3.10.0-1160.83.1.el7.x86_64 #1 SMP Wed Jan 25 16:41:43 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
重现此问题的步骤
- 使用保留会话建立连接
- 使emqx服务器内存占满后自动杀死进程并重启
- 使用之前的客户端使用相同的clientId再次选择保留会话建立连接
预期行为
emqx重启后之前选择了保留会话的客户端可以再次正常连接
实际行为
再次连接出现crasher
2023-10-23T20:09:15+08:00 [MQTT] 82176d1ca7cb49c08430856300240532@10.0.0.82:62864 msg: mqtt_packet_received, packet: CONNECT(Q0, R0, D0, ClientId=82176d1ca7cb49c08430856300240532, ProtoName=MQTT, ProtoVsn=5, CleanStart=false, KeepAlive=360, Username=82176, Password=******)
2023-10-23T20:09:15+08:00 [AUTHN] 82176d1ca7cb49c08430856300240532@10.0.0.82:62864 msg: authenticator_result, authenticator: jwt, result: {ok,#{is_superuser => false}}
2023-10-23T20:09:15+08:00 [AUTHN] 82176d1ca7cb49c08430856300240532@10.0.0.82:62864 msg: authentication_result, reason: chain_result, result: {stop,{ok,#{is_superuser => false}}}
2023-10-23T20:09:16+08:00 [SUBSCRIBE] 82176d1ca7cb49c08430856300240532@10.0.0.82:62864 msg: subscribe, sub_id: 82176d1ca7cb49c08430856300240532, sub_opts: [nl: 0, qos: 2, rap: 0, rh: 0, sub_props: ], topic: /find/device/82176d1ca7cb49c08430856300240532/find
2023-10-23T20:09:16+08:00 [SUBSCRIBE] 82176d1ca7cb49c08430856300240532@10.0.0.82:62864 msg: subscribe, sub_id: 82176d1ca7cb49c08430856300240532, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: ], topic: /find/device/82176d1ca7cb49c08430856300240532/find/location
2023-10-23T20:09:16+08:00 [SUBSCRIBE] 82176d1ca7cb49c08430856300240532@10.0.0.82:62864 msg: subscribe, sub_id: 82176d1ca7cb49c08430856300240532, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: ], topic: /find/device/82176d1ca7cb49c08430856300240532/find/location/realTime
2023-10-23T20:09:16+08:00 [SUBSCRIBE] 82176d1ca7cb49c08430856300240532@10.0.0.82:62864 msg: subscribe, sub_id: 82176d1ca7cb49c08430856300240532, sub_opts: [nl: 0, qos: 2, rap: 0, rh: 0, sub_props: ], topic: /find/device/82176d1ca7cb49c08430856300240532/find/lost/close
2023-10-23T20:09:16+08:00 [SUBSCRIBE] 82176d1ca7cb49c08430856300240532@10.0.0.82:62864 msg: subscribe, sub_id: 82176d1ca7cb49c08430856300240532, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: ], topic: /find/device/82176d1ca7cb49c08430856300240532/lost/status
2023-10-23T20:09:16+08:00 [SUBSCRIBE] 82176d1ca7cb49c08430856300240532@10.0.0.82:62864 msg: subscribe, sub_id: 82176d1ca7cb49c08430856300240532, sub_opts: [nl: 0, qos: 2, rap: 0, rh: 0, sub_props: ], topic: /find/device/82176d1ca7cb49c08430856300240532/reset
2023-10-23T20:09:16+08:00 [SUBSCRIBE] 82176d1ca7cb49c08430856300240532@10.0.0.82:62864 msg: subscribe, sub_id: 82176d1ca7cb49c08430856300240532, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: ], topic: /find/device/82176d1ca7cb49c08430856300240532/ring
2023-10-23T20:09:16+08:00 [SUBSCRIBE] 82176d1ca7cb49c08430856300240532@10.0.0.82:62864 msg: subscribe, sub_id: 82176d1ca7cb49c08430856300240532, sub_opts: [nl: 0, qos: 1, rap: 0, rh: 0, sub_props: ], topic: /find/device/82176d1ca7cb49c08430856300240532/ring/info
2023-10-23T20:09:16+08:00 [SOCKET] 82176d1ca7cb49c08430856300240532@10.0.0.82:62864 msg: emqx_connection_terminated, reason: [context: {noproc,{gen_server,call,[false,{pending,<<0,6,8,92,133,206,125,134,159,251,126,22,81,130,0,0>>,},infinity]}}, exception: exit, stacktrace: [{gen_server,call,3,[{file,“gen_server.erl”},{line,247}]},{emqx_persistent_session,pending,2,[{file,“emqx_persistent_session.erl”},{line,412}]},{emqx_persistent_session,resume,3,[{file,“emqx_persistent_session.erl”},{line,317}]},{emqx_cm,‘-open_session/3-fun-2-’,5,[{file,“emqx_cm.erl”},{line,297}]},{emqx_cm_locker,trans,3,[{file,“emqx_cm_locker.erl”},{line,51}]},{emqx_channel,process_connect,2,[{file,“emqx_channel.erl”},{line,620}]},{emqx_connection,with_channel,3,[{file,“emqx_connection.erl”},{line,833}]},{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}]}]]
2023-10-23T20:09:16.144031+08:00 [error] crasher: initial call: emqx_connection:init/4, pid: <0.20609.988>, registered_name: , exit: {{noproc,{gen_server,call,[false,{pending,<<0,6,8,92,133,206,125,134,159,251,126,22,81,130,0,0>>,},infinity]}},[{gen_server,call,3,[{file,“gen_server.erl”},{line,247}]},{emqx_persistent_session,pending,2,[{file,“emqx_persistent_session.erl”},{line,412}]},{emqx_persistent_session,resume,3,[{file,“emqx_persistent_session.erl”},{line,317}]},{emqx_cm,‘-open_session/3-fun-2-’,5,[{file,“emqx_cm.erl”},{line,297}]},{emqx_cm_locker,trans,3,[{file,“emqx_cm_locker.erl”},{line,51}]},{emqx_channel,process_connect,2,[{file,“emqx_channel.erl”},{line,620}]},{emqx_connection,with_channel,3,[{file,“emqx_connection.erl”},{line,833}]},{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.9641.24>,<0.9640.24>,esockd_sup,<0.2176.0>], message_queue_len: 0, messages: , links: [<0.9641.24>], dictionary: [{recv_pkt,1},{‘$logger_metadata$’,#{clientid => <<“82176d1ca7cb49c08430856300240532”>>,peername => “10.0.0.82:62864”}},{incoming_bytes,402}], trap_exit: false, status: running, heap_size: 4185, stack_size: 28, reductions: 19542; neighbours: