From 069afd042a59b8fcc0bee706d82cd8f7ca952d98 Mon Sep 17 00:00:00 2001 From: JianBo He Date: Sat, 15 Apr 2023 21:18:37 +0800 Subject: [PATCH] chore: update changes --- bin/nodetool | 11 +++++++++-- changes/ce/fix-10410.en.md | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 changes/ce/fix-10410.en.md diff --git a/bin/nodetool b/bin/nodetool index 9f32f9b3b..8170e68e2 100755 --- a/bin/nodetool +++ b/bin/nodetool @@ -272,7 +272,7 @@ chkconfig(File) -> end. check_license(Config) -> - ok = application:load(emqx_license), + ok = ensure_application_load(emqx_license), %% This checks formal license validity to ensure %% that the node can successfully start with the given license. @@ -368,7 +368,7 @@ add_lib_dir(RootDir, Name, Vsn) -> %% %% It helps to implement the feature of dynamically searching schema. %% See `emqx_gateway_schema:fields(gateway)` - is_emqx_application(Name) andalso application:load(Name), + is_emqx_application(Name) andalso ensure_application_load(Name), ok; {error, _} -> error(LibDir) end. @@ -379,3 +379,10 @@ is_emqx_application("emqx_" ++ _Rest) -> true; is_emqx_application(_) -> false. + +ensure_application_load(Name) -> + case application:load(Name) of + ok -> ok; + {error, {already_loaded, _}} -> ok; + {error, Reason} -> error({failed_to_load_application, Name, Reason}) + end. diff --git a/changes/ce/fix-10410.en.md b/changes/ce/fix-10410.en.md new file mode 100644 index 000000000..48b55ea31 --- /dev/null +++ b/changes/ce/fix-10410.en.md @@ -0,0 +1,2 @@ +Fix EMQX starting failed once any gateways configured in emqx.conf. +This issue was first introduced in v5.0.22 via [#10278](https://github.com/emqx/emqx/pull/10278).