5.0.20版本开启http接口授权认证之后,大并发请求几次之后就会断开mqtt连接报错

错误报告

环境

  • EMQX 版本:5.0.20
  • 操作系统版本:

重现此问题的步骤

升级到5.0.20版本,授权开启http请求之后,我们服务端还是请求量大还是会报错,帮忙看一下,错误日志如下:

e: <<“conn_congestion/9c00b9c500e247199ed05eda96c6a3de/XX”>>
2023-03-20T14:36:30.145234+00:00 [error] msg: unexpected_sock_close, mfa: emqx_channel:handle_info/2, line: 1266, peername: 1.193.37.50:49975, clientid: .ss.CSzqaLZnz8jRjyjm2kdAbK7S_RNv4Urhcyb0bqWRFCg, reason: einval
2023-03-20T14:40:33.448894+00:00 [error] msg: unexpected_sock_close, mfa: emqx_channel:handle_info/2, line: 1266, peername: 192.168.4.188:41832, clientid: .ss.lr0ilVRqWmooMfl9O7Xa6XQLsv_6ThSWDiIDXg0VgA8, reason: tcp_closed
2023-03-20T14:40:39.395690+00:00 [warning] msg: alarm_is_activated, mfa: emqx_alarm:do_actions/3, line: 416, message: <<“connection congested: #{buffer => 4096,clientid => <<“9c00b9c500e247199ed05eda96c6a3de”>>,conn_state => connected,connected_at => 1679323237506,high_msgq_watermark => 8192,high_watermark => 1048576,memory => 627152,message_queue_len => 237,peername => <<“192.168.4.192:45054”>>,pid => <<“<0.28703.8>”>>,proto_name => <<“MQTT”>>,proto_ver => 5,recbuf => 442232,recv_cnt => 100,recv_oct => 97700,re”…>>, name: <<“conn_congestion/9c00b9c500e247199ed05eda96c6a3de/ss”>>
2023-03-20T14:40:43.838837+00:00 [warning] msg: alarm_is_deactivated, mfa: emqx_alarm:do_actions/3, line: 422, name: <<“conn_congestion/9c00b9c500e247199ed05eda96c6a3de/bb”>>
2023-03-20T14:40:48.626268+00:00 [warning] msg: alarm_is_activated, mfa: emqx_alarm:do_actions/3, line: 416, message: <<“connection congested: #{buffer => 4096,clientid => <<“9c00b9c500e247199ed05eda96c6a3de”>>,conn_state => connected,connected_at => 1679323246848,high_msgq_watermark => 8192,high_watermark => 1048576,memory => 1023792,message_queue_len => 524,peername => <<“192.168.4.192:45922”>>,pid => <<“<0.30778.8>”>>,proto_name => <<“MQTT”>>,proto_ver => 5,recbuf => 374400,recv_cnt => 100,recv_oct => 90035,r”…>>, name: <<“conn_congestion/9c00b9c500e247199ed05eda96c6a3de/ss”>>
2023-03-20T14:40:53.611909+00:00 [warning] msg: alarm_is_deactivated, mfa: emqx_alarm:do_actions/3, line: 422, name: <<“conn_congestion/9c00b9c500e247199ed05eda96c6a3de/bb”>>

预期行为

实际行为


功能请求

描述你需要的功能

为什么你需要这个功能


其他

可能和 HTTP 认证不一定有关系…看日志

msg: alarm_is_activated, mfa: emqx_alarm:do_actions/3, line: 416, message: <<“connection congested: #{buffer => 4096,clientid => <<“9c00b9c500e247199ed05eda96c6a3de”>>,conn_state => connected,connected_at => 1679323246848,high_msgq_watermark => 8192,high_watermark => 1048576,memory => 1023792,message_queue_len => 524,peername => <<“192.168.4.192:45922”>>,pid => <<“<0.30778.8>”>>,proto_name => <<“MQTT”>>,proto_ver => 5,recbuf => 374400,recv_cnt => 100,recv_oct => 90035,r”…>>,

是指你的 这个 MQTT 客户端,接收消息已经处理不过来了。所以才会被断开

这个哪个错误看出来的,有可以改的配置吗?我们客户端是服务端,需要对很多客户端进行转发请求,这个因为我们的发布和订阅权限没有分开,请求比较大

我们开启了授权就不行了,没开启就可以

您好, 你们多大的并发呢?

每秒几十条到上百条

发布和订阅建议分开,否则业务没法开启,特别是服务端这种业务

conn_congestion 这个告警看出来的

它指的就是你的客户端接受处理不过来了,很多消息堆积到了 TCP 上,EMQX 检查到了这种情况就会告警