环境信息
- EMQX 版本:4.3.6
- 操作系统及版本:centos7 阿里龙蜥8.6
- 其他
问题描述
emqx连接需要鉴权,所以用了emqx_auth_http这个方式。其他方式没考虑,因为http毕竟代码自由度高一点。但是医院客户现场设备量在1000左右,会报"gun_error"和相关emqx_auth_http failed to Execute的问题。然后会导致服务端一系列错误,比如redis server went away等。研发猜测是和文件句柄相关。emqx_auth_http里的代码很简单,是采用算法形式的验证,没有和redis和数据库有交互,正常情况下没有问题。
配置文件及日志
emqx_log.tar.gz (2.8 MB)
2022-10-18 12:26:22.876 [error] <<“N04A8111068”>>@166.2.28.107:54762 [Hooks] Failed to execute {emqx_auth_http,check,[#{auth_req => {http_request,post,"/api/v1/mqtt/auth",[{<<“content-type”>>,<<“application/x-www-form-urlencoded”>>}],[{“clientid”,"%c"},{“username”,"%u"},{“password”,"%P"},{“ipaddress”,"%a"}],5000},pool_name => emqx_auth_http,super_req => undefined}]}: {{timeout,{gen_server,call,[<0.1788.0>,{post,{"/api/v1/mqtt/auth",[{<<“content-type”>>,<<“application/x-www-form-urlencoded”>>}],<<“clientid=N04A8111068&username=60000000767945&password=2013012679&ipaddress=166.2.28.107”>>},5000},6000]}},[{gen_server,call,3,[{file,“gen_server.erl”},{line,223}]},{emqx_auth_http_cli,do_request,5,[{file,“emqx_auth_http_cli.erl”},{line,50}]},{emqx_auth_http,check,3,[{file,“emqx_auth_http.erl”},{line,45}]},{emqx_hooks,safe_execute,2,[{file,“emqx_hooks.erl”},{line,164}]},{emqx_hooks,do_run_fold,3,[{file,“emqx_hooks.erl”},{line,143}]},{emqx_access_control,authenticate,1,[{file,“emqx_access_control.erl”},{line,77}]},{emqx_channel,auth_connect,2,[{file,“emqx_channel.erl”},{line,1181}]},{emqx_misc,pipeline,3,[{file,“emqx_misc.erl”},{line,107}]}]}
2022-10-18 12:26:22.877 [warning] <<“N04A8111068”>>@166.2.28.107:54762 [Channel] Client N04A8111068 (Username: ‘60000000767945’) login failed for not_authorized
2022-10-18 12:26:22.900 [error] Received ‘gun_error’ message from unknown stream ref: #Ref<0.73929297.1505492996.10678>
2022-10-18 12:26:22.930 [error] Received ‘gun_error’ message from unknown stream ref: #Ref<0.73929297.1505492994.856>
2022-10-18 12:26:22.937 [error] Received ‘gun_error’ message from unknown stream ref: #Ref<0.73929297.1505492996.17378>
2022-10-18 12:26:22.952 [error] Received ‘gun_error’ message from unknown stream ref: #Ref<0.73929297.1505230878.255109>
2022-10-18 12:26:22.982 [error] Received ‘gun_error’ message from unknown stream ref: #Ref<0.73929297.1505230878.255187>
2022-10-18 12:26:22.990 [error] Received ‘gun_error’ message from unknown stream ref: #Ref<0.73929297.1505230878.255149>