Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: authentication should be array, not struct #8924

Merged
merged 6 commits into from Oct 17, 2022

Conversation

zhongwencool
Copy link
Member

@zhongwencool zhongwencool commented Sep 8, 2022

Try to fix: #8784

  • Ensure authentication type is an array, not struct.

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 3049800820

  • 9 of 13 (69.23%) changed or added relevant lines in 3 files are covered.
  • 32 unchanged lines in 16 files lost coverage.
  • Overall coverage decreased (-0.02%) to 77.372%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/emqx_authn/src/emqx_authn.erl 0 1 0.0%
apps/emqx_authn/src/emqx_authn_app.erl 8 11 72.73%
Files with Coverage Reduction New Missed Lines %
apps/emqx_authn/src/emqx_authn_api.erl 1 85.23%
apps/emqx_conf/src/emqx_conf_schema.erl 1 92.31%
apps/emqx_gateway/src/emqx_gateway_schema.erl 1 90.0%
apps/emqx_machine/src/emqx_machine.erl 1 79.31%
apps/emqx/src/emqx_broker.erl 1 83.52%
apps/emqx/src/emqx_channel.erl 1 86.36%
apps/emqx/src/emqx_config_handler.erl 1 96.34%
apps/emqx/src/emqx_flapping.erl 1 85.11%
apps/emqx/src/emqx_message.erl 1 94.12%
apps/emqx/src/emqx_router_utils.erl 1 60.47%
Totals Coverage Status
Change from base Build 3049512272: -0.02%
Covered Lines: 20632
Relevant Lines: 26666

💛 - Coveralls

@zhongwencool zhongwencool requested review from savonarola and a team September 15, 2022 09:33
@zmstone
Copy link
Member

zmstone commented Sep 15, 2022

could you post the new error message (in case e.g. mechanism is missing as reported in the issue)?

@zhongwencool
Copy link
Member Author

could you post the new error message (in case e.g. mechanism is missing as reported in the issue)?

2022-09-15T18:08:07.652351+08:00 [error] line: 71, mfa: emqx_authn_app:initialize/0, msg: failed_to_initialize_authentication, reason: {invalid_config,"mechanism_field_required"}
2022-09-15T18:08:07.652758+08:00 [error] crasher: initial call: application_master:init/4, pid: <0.2396.0>, registered_name: [], exit: {{{failed_to_initialize_authentication,{invalid_config,"mechanism_field_required"}},{emqx_authn_app,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,142}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}, ancestors: [<0.2395.0>], message_queue_len: 1, messages: [{'EXIT',<0.2397.0>,normal}], links: [<0.2395.0>,<0.1673.0>], dictionary: [], trap_exit: true, status: running, heap_size: 376, stack_size: 29, reductions: 167; neighbours:
2022-09-15T18:08:07.656996+08:00 [critical] app: emqx_authn, line: 88, mfa: emqx_machine_boot:start_one_app/1, msg: failed_to_start_app, reason: {emqx_authn,{{failed_to_initialize_authentication,{invalid_config,"mechanism_field_required"}},{emqx_authn_app,start,[normal,[]]}}}
2022-09-15T18:08:07.657447+08:00 [error] Supervisor: {local,emqx_machine_sup}. Context: start_error. Reason: {'EXIT',{{failed_to_start_app,emqx_authn,{emqx_authn,{{failed_to_initialize_authentication,{invalid_config,"mechanism_field_required"}},{emqx_authn_app,start,[normal,[]]}}}},[{emqx_machine_boot,start_one_app,1,[{file,"emqx_machine_boot.erl"},{line,89}]},{lists,foreach,2,[{file,"lists.erl"},{line,1342}]},{emqx_machine_boot,post_boot,0,[{file,"emqx_machine_boot.erl"},{line,38}]},{supervisor,do_start_child_i,3,[{file,"supervisor.erl"},{line,414}]},{supervisor,do_start_child,2,[{file,"supervisor.erl"},{line,400}]},{supervisor,'-start_children/2-fun-0-',3,[{file,"supervisor.erl"},{line,384}]},{supervisor,children_map,4,[{file,"supervisor.erl"},{line,1250}]},{supervisor,init_children,2,[{file,"supervisor.erl"},{line,350}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,423}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}. Offender: id=emqx_machine_boot,pid=undefined.
2022-09-15T18:08:07.657931+08:00 [error] crasher: initial call: application_master:init/4, pid: <0.1913.0>, registered_name: [], exit: {{{shutdown,{failed_to_start_child,emqx_machine_boot,{'EXIT',{{failed_to_start_app,emqx_authn,{emqx_authn,{{failed_to_initialize_authentication,{invalid_config,"mechanism_field_required"}},{emqx_authn_app,start,[normal,[]]}}}},[{emqx_machine_boot,start_one_app,1,[{file,"emqx_machine_boot.erl"},{line,89}]},{lists,foreach,2,[{file,"lists.erl"},{line,1342}]},{emqx_machine_boot,post_boot,0,[{file,"emqx_machine_boot.erl"},{line,38}]},{supervisor,do_start_child_i,3,[{file,"supervisor.erl"},{line,414}]},{supervisor,do_start_child,2,[{file,"supervisor.erl"},{line,400}]},{supervisor,'-start_children/2-fun-0-',3,[{file,"supervisor.erl"},{line,384}]},{supervisor,children_map,4,[{file,"supervisor.erl"},{line,1250}]},{supervisor,init_children,2,[{file,"supervisor.erl"},{line,350}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,423}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}}},{emqx_machine_app,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,142}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}, ancestors: [<0.1912.0>], message_queue_len: 1, messages: [{'EXIT',<0.1914.0>,normal}], links: [<0.1912.0>,<0.1673.0>], dictionary: [], trap_exit: true, status: running, heap_size: 1598, stack_size: 29, reductions: 239; neighbours:

Copy link
Contributor

@thalesmg thalesmg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this feasible to test? If so, it might be worth adding a test case for that.

@zhongwencool zhongwencool merged commit bc0cc80 into emqx:master Oct 17, 2022
@zhongwencool zhongwencool deleted the authn-config-check branch October 17, 2022 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EMQX crashes at startup if configuration keys are missing
4 participants