exception: error, line: 410, mfa: emqx_authz:do_authorize/4

环境信息

  • EMQX 版本:5.0.8
  • 操作系统及版本:docker
  • 其他

问题描述

不停的报warning异常

配置文件及日志

2022-09-19T04:16:58.499505+00:00 [warning] authorize_type: mysql, clientid: 36890000001325, exception: error, line: 410, mfa: emqx_authz:do_authorize/4, msg: unexpected_error_in_authorize, peername: 101.228.50.45:21272, reason: badarith, stacktrace: [{lists,nth,2,[{file,“lists.erl”},{line,172}]},{emqx_authz_mysql,format_result,2,[{file,“emqx_authz_mysql.erl”},{line,117}]},{emqx_authz_mysql,do_authorize,5,[{file,“emqx_authz_mysql.erl”},{line,109}]},{emqx_authz,do_authorize,4,[{file,“emqx_authz.erl”},{line,387}]},{emqx_authz,authorize_non_superuser,5,[{file,“emqx_authz.erl”},{line,338}]},{emqx_hooks,safe_execute,2,[{file,“emqx_hooks.erl”},{line,200}]},{emqx_hooks,do_run_fold,3,[{file,“emqx_hooks.erl”},{line,180}]},{emqx_access_control,do_authorize,3,[{file,“emqx_access_control.erl”},{line,99}]},{emqx_access_control,check_authorization_cache,3,[{file,“emqx_access_control.erl”},{line,60}]},{emqx_access_control,authorize,3,[{file,“emqx_access_control.erl”},{line,51}]},{emqx_channel,check_pub_authz,2,[{file,“emqx_channel.erl”},{line,1831}]},{emqx_misc,pipeline,3,[{file,“emqx_misc.erl”},{line,156}]},{emqx_channel,process_publish,2,[{file,“emqx_channel.erl”},{line,638}]},{emqx_connection,with_channel,3,[{file,“emqx_connection.erl”},{line,790}]},{emqx_connection,process_msg,2,[{file,“emqx_connection.erl”},{line,466}]},{emqx_connection,process_msg,2,[{file,“emqx_connection.erl”},{line,472}]},{emqx_connection,handle_recv,3,[{file,“emqx_connection.erl”},{line,428}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,236}]}]

2022-09-19T04:22:19.413869+00:00 [warning] authorize_type: mysql, clientid: 8ae20000001098, exception: error, line: 410, mfa: emqx_authz:do_authorize/4, msg: unexpected_error_in_authorize, peername: 113.91.61.141:25693, reason: badarith, stacktrace: [{lists,nth,2,[{file,“lists.erl”},{line,172}]},{emqx_authz_mysql,format_result,2,[{file,“emqx_authz_mysql.erl”},{line,117}]},{emqx_authz_mysql,do_authorize,5,[{file,“emqx_authz_mysql.erl”},{line,109}]},{emqx_authz,do_authorize,4,[{file,“emqx_authz.erl”},{line,387}]},{emqx_authz,authorize_non_superuser,5,[{file,“emqx_authz.erl”},{line,338}]},{emqx_hooks,safe_execute,2,[{file,“emqx_hooks.erl”},{line,200}]},{emqx_hooks,do_run_fold,3,[{file,“emqx_hooks.erl”},{line,180}]},{emqx_access_control,do_authorize,3,[{file,“emqx_access_control.erl”},{line,99}]},{emqx_access_control,check_authorization_cache,3,[{file,“emqx_access_control.erl”},{line,60}]},{emqx_access_control,authorize,3,[{file,“emqx_access_control.erl”},{line,51}]},{emqx_channel,check_pub_authz,2,[{file,“emqx_channel.erl”},{line,1831}]},{emqx_misc,pipeline,3,[{file,“emqx_misc.erl”},{line,156}]},{emqx_channel,process_publish,2,[{file,“emqx_channel.erl”},{line,638}]},{emqx_connection,with_channel,3,[{file,“emqx_connection.erl”},{line,790}]},{emqx_connection,process_msg,2,[{file,“emqx_connection.erl”},{line,466}]},{emqx_connection,process_msg,2,[{file,“emqx_connection.erl”},{line,472}]},{emqx_connection,handle_recv,3,[{file,“emqx_connection.erl”},{line,428}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,236}]}]
is_superuser

authentication {
auto_reconnect = true
backend = “mysql”
database =
enable = true
mechanism = “password_based”
password =
password_hash_algorithm {name = “md5”, salt_position = “disable”}
pool_size = 8
query = “SELECT password,is_superuser FROM mqtt_user where username = ${username} LIMIT 1”
query_timeout = “5s”
server =
ssl {
depth = 10
enable = false
reuse_sessions = true
secure_renegotiate = true
user_lookup_fun = “emqx_tls_psk:lookup”
verify = “verify_peer”
versions = [“tlsv1.3”, “tlsv1.2”, “tlsv1.1”, “tlsv1”]
}
username = “cloud”
}
authorization {
deny_action = “ignore”
no_match = “deny”
sources = [
{
auto_reconnect = true
database =
enable = true
password =
pool_size = 8
query = “select allow, username, clientid, access, topic from mqtt_acl where username = ${username} and clientid = ${clientid} LIMIT 1”
server =
ssl {
depth = 10
enable = false
reuse_sessions = true
secure_renegotiate = true
user_lookup_fun = “emqx_tls_psk:lookup”
verify = “verify_peer”
versions = [“tlsv1.3”, “tlsv1.2”, “tlsv1.1”, “tlsv1”]
}
type = “mysql”
username =
},
{
enable = true
path = “data/authz/acl.conf”
type = “file”
}
]
}

@juncheung90 这是一个 Bug, 然后原因是你的 ACL 字段不对,没有必要的字段,你可以看下这个文档