To reproduce, use a configuration setting that depends on a plugin to be enabled that isn't enabled. In this case, the following rabbitmq.conf file was used, but the rabbitmq_auth_backend_cache plugin is disabled:
auth_backends.1 = cache
auth_cache.cached_backend = internal
Using RabbitMQ 3.7.17, the following is output: unfriendly-output.txt
[168035166]
Hi there @lukebakken can I take this issue onto me? What would the more friendly behaviour be in this case?
The Erlang VM shouldn't crash in this case but show helpful error output like this:
```
09:50:14.776 [error] You've tried to set auth_cache.cached_backend, but there is no setting with that name.
09:50:14.776 [error] Did you mean one of these?
09:50:14.805 [error] auth_backends.$num.authn
09:50:14.805 [error] auth_backends.$num
09:50:14.805 [error] auth_backends.$num.authz
09:50:14.805 [error] Error generating configuration in phase transform_datatypes
09:50:14.805 [error] Conf file attempted to set unknown variable: auth_cache.cached_backend
````
@lukebakken been investigating the bug a bit, but a bit stuck right now, hoping you could advice me.
The helpful error output we see (along with the crash) seems to come from the cuttlefish tool that's called through the Command in rabbit_config:generate_config_file/5.
This output is given instead of a normally expected output in the style of -config /tmp/rabbitmq-test-instances/rabbit/config/generated/rabbitmq.2019.09.03.13.25.03.config -args_file /tmp/rabbitmq-test-instances/rabbit/config/generated/vm.2019.09.03.13.25.03.args -vm_args /tmp/rabbitmq-test-instances/rabbit/config/generated/vm.2019.09.03.13.25.03.args.
This regular format is required at the bottom of the function, but because of a missing " -config " in the output, we get the error instead.
Of course we could just show this output, but it seems that the cuttlefish tool also doesn't generate the files we'd expect in the config folder. Simply showing the output and not crashing seems impossible because of this reason.
This is solved in 3.8.0. We have a nice clean error without the unrelated lager crashes:
Erlang/OTP 22 [erts-10.4.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:192] [hipe] [dtrace]
Eshell V10.4.4 (abort with ^G)
(rabbit@mars)1>
BOOT FAILED
===========
Config file generation failed:
15:23:34.454 [error] You've tried to set auth_cache.cached_backend, but there is no setting with that name.
15:23:34.454 [error] Did you mean one of these?
15:23:34.470 [error] auth_backends.$num.authn
15:23:34.470 [error] auth_backends.$num
15:23:34.470 [error] auth_backends.$num.authz
15:23:34.470 [error] Error generating configuration in phase transform_datatypes
15:23:34.470 [error] Conf file attempted to set unknown variable: auth_cache.cached_backend
{"init terminating in do_boot",generate_config_file}
init terminating in do_boot (generate_config_file)
@vanseverk The configuration is not generated because it contains an unknown entry, so the system can't start. Hopefully now the error is clear.
@dcorbacho I was assuming the goal was to start the RabbitMQ server despite the unknown entries which seemed like an impossible scenario to me. Good to see the issue fixed, though!
The goal is to provide a helpful message. It can still be improved by mentioning that a plugin might need enabling for certain config entries to become "known" to the broker.
Thanks for the suggestion, @michaelklishin I have created a PR with an improved error message
Most helpful comment
This is solved in 3.8.0. We have a nice clean error without the unrelated
lagercrashes:@vanseverk The configuration is not generated because it contains an unknown entry, so the system can't start. Hopefully now the error is clear.