开源版本EMQX websocket 会不定时断开连接

版本号: [5.8.0 (Open Source)]

描述:
websocket模式下连接订阅主题后一直在收取消息的情况会不定时出现连接断开的情况,有时候几秒,有时候几十秒, 但是非websocket 模式下是正常的,不会自动断开连接, 有遇到过相同问题的小伙伴吗?

使用工具
MQTTX, 配置了 keep alive

服务端日志:
2025-04-11T17:34:06.929493+08:00 [debug] tag: SOCKET, clientid: wss-mqttx_6a8bcdd2, msg: websocket_terminated, peername: 183.36.81.17:5989, username: wanrun_plat, reason: {crash,error,{badmatch,18906}}
2025-04-11T17:34:06.929719+08:00 [error] crasher: initial call: cowboy_tls:connection_process/4, pid: <0.3202765.0>, registered_name: , error: {{badmatch,18906},[{emqx_ws_connection,handle_outgoing,2,[{file,“emqx_ws_connection.erl”},{line,814}]},{emqx_ws_connection,websocket_info,2,[{file,“emqx_ws_connection.erl”},{line,998}]},{cowboy_websocket,handler_call,6,[{file,“cowboy_websocket.erl”},{line,487}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,251}]}]}, ancestors: [<0.2746.0>,<0.2745.0>,ranch_sup,<0.2434.0>], message_queue_len: 0, messages: , links: [<0.2746.0>], dictionary: [{send_cnt,104},{‘send_msg.qos0’,101},{recv_oct,88},{recv_cnt,3},{‘$logger_metadata$’,#{peername => “xxx.xxx.xxx.17:5989”,username => <<“xxxxx”>>,clientid => <<“wss-mqttx_6a8bcdd2”>>}},{{#{action_type => subscribe,qos => 0},<<“sys/#”>>},{allow,1744364036248}},{authz_keys_q,{[{#{action_type => subscribe,qos => 0},<<“sys/#”>>}],}},{recv_pkt,3},{authz_cache_size,1},{send_pkt,104},{send_oct,18906},{send_msg,101},{guid,{1744364036186184,268577193123533,1}},{outgoing_pubs,0},{outgoing_bytes,0},{incoming_bytes,88}], trap_exit: true, status: running, heap_size: 4185, stack_size: 28, reductions: 600410; neighbours:
2025-04-11T17:34:06.930134+08:00 [error] Ranch listener ‘wss:default’ had connection process started with cowboy_tls:start_link/4 at <0.3202765.0> exit with reason: {{badmatch,18906},[{emqx_ws_connection,handle_outgoing,2,[{file,“emqx_ws_connection.erl”},{line,814}]},{emqx_ws_connection,websocket_info,2,[{file,“emqx_ws_connection.erl”},{line,998}]},{cowboy_websocket,handler_call,6,[{file,“cowboy_websocket.erl”},{line,487}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,251}]}]}
2025-04-11T17:34:06.930360+08:00 [debug] msg: emqx_cm_clean_down, client_id: <<“wss-mqttx_6a8bcdd2”>>

MQTTX客户端日志

你更新到5.8.6就好了,这是一个bug来的

1 个赞

好的,感谢支持