MQTT开启http 连接认证,但http服务正常,Mqtt显示数据源状态已断开

环境

  • EMQX 版本:5.0.17
  • 操作系统版本:centos7

重现此问题的步骤


在mqtt后台配置http认征,使用一段时间后,发现认证失败,查看后台发现某个节点认征的数据源断开,后台日志显示2023-05-05T15:01:40.885354+08:00 [error] msg: resource_stopped, mfa: emqx_resource_buffer_worker:handle_query_result_pure/3, line: 773, peername: 10.16.115.193:51137, clientid: huozhaojin1, id: <<“emqx_authn_http:4”>>, info: resource stopped or disabled
但这时http服务是正常的。

预期行为

后台数据源应该正常

实际行为

集群的2个节点发现一个节点的数据源断开。

看下这个 115.193 这个节点的 EMQX 日志;是否有相关的报错呢

报错信息有,但看不出哪里错跟目前反馈的这个问题相关的,日志如下。
emqx.log.1.zip (2.5 MB)

关于http认征数据源没法重连问题请问是否是一个BUG呢?

  1. 日志里,这个问题应该在最新版本解决了,可以试试看
2023-04-29T01:03:30.212426+08:00 [error] State machine <0.2632.0> terminating. Reason: {timeout,{gen_server,call,[emqx_alarm,{deactivate_alarm,<<"emqx_authn_http:4">>,no_details,<<>>}]}}. Stack: [{gen_server,call,2,[{file,"gen_server.erl"},{line,239}]},{emqx_resource_manager,stop_resource,1,[{file,"emqx_resource_manager.erl"},{line,515}]},{emqx_resource_manager,terminate,3,[{file,"emqx_resource_manager.erl"},{line,311}]},{gen_statem,terminate,7,[{file,"gen_statem.erl"},{line,2365}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]. Last event: {state_timeout,health_check}. State: {connected,{data,<<"emqx_authn_http:4">>,<<"emqx_authn_http:4:5">>,<<"emqx_authn">>,emqx_connector_http,async_if_possible,sync,#{backend => http,base_url => #{host => {10,16,115,191},path => "/",port => 36331,scheme => https},body => #{clientid => <<"${clientid}">>,password => <<"${password}">>,username => <<"${username}">>},connect_timeout => 5000,enable => true,enable_pipelining => 100,headers => #{accept => <<"application/json">>,'cache-control' => <<"no-cache">>,connection => <<"keep-alive">>,'content-type' => <<"application/json">>,'keep-alive' => <<"timeout=30, max=1000">>},mechanism => password_based,method => post,pool_size => 8,pool_type => random,request_timeout => 5000,ssl => #{certfile => <<"data/certs/authn/mqtt-global-password_based-http/cert-e37656234ab3dfa3">>,ciphers => [],depth => 10,enable => true,keyfile => <<"data/certs/authn/mqtt-global-password_based-http/key-54238bdb28a54548">>,reuse_sessions => true,secure_renegotiate => true,user_lookup_fun => {fun emqx_tls_psk:lookup/3,undefined},verify => verify_none,versions => ['tlsv1.3','tlsv1.2','tlsv1.1',tlsv1]},url => <<"https://10.16.115.191:36331/api/device/auth">>},#{start_after_created => false},connected,#{base_path => "/",connect_timeout => 5000,host => {10,16,115,191},pool_name => 'emqx_authn_http:4:5',pool_type => random,port => 36331,request => undefined},undefined,<0.2632.0>}}.
2
  1. AuthN HTTP 配置的地址是外网地址么?看着有一些超时的日志

AuthN HTTP 配置的地址是内网的,那我先升级最新的版本再观察下,谢谢!

1 个赞