rabbitmq / rabbitmq-server

Open source RabbitMQ: core server and tier 1 (built-in) plugins
https://www.rabbitmq.com/
Other
11.84k stars 3.9k forks source link

Tracing log files directory validation (moved to #11554) #11551

Closed razvanphp closed 1 week ago

razvanphp commented 1 week ago

Describe the bug

Not sure why my previous bug issue was deleted without a notice, but I will rephrase so that it's clear what the bug is, now that I confirmed it locally.

rabbitmq_tracing plugin configuration, more precisely directory is:

  1. not checked on runtime / startup, if it exists and it is writable
  2. not configurable in the new conf style

Reproduction steps

  1. enable rabbitmq_tracing plugin
  2. make folder /var/tmp/rabbitmq-tracing read-only
  3. go to the management GUI / Admin / Trace page
  4. you will see a fatal error:
    Node 'rabbit@rabbitmq-0.(my-cluster-details).svc.cluster.local' could not be contacted: {badrpc,
    {'EXIT',
    {{badmatch,
    {error,
    erofs}},
    [{rabbit_tracing_files,
    list,
    0,
    [{file,
    "rabbit_tracing_files.erl"},
    {line,
    18}]}]}}}

Expected behavior

On startup, the server checks if this directory exists and is writable and throws a fatal error otherwise.

Also, configuration for this plugin should also be available in the new config format, currently that's not possible:

2024-06-24 09:45:46.643406+00:00 [error] <0.156.0> Error preparing configuration in phase transform_datatypes:
2024-06-24 09:45:46.643462+00:00 [error] <0.156.0>   - Conf file attempted to set unknown variable: rabbitmq_tracing.password
2024-06-24 09:45:46.643530+00:00 [error] <0.156.0>   - Conf file attempted to set unknown variable: rabbitmq_tracing.username
2024-06-24 09:45:46.643588+00:00 [error] <0.156.0>   - Conf file attempted to set unknown variable: rabbitmq_tracing.directory

... same thing without rabbitmq_ prefix, it only works in advanced.config formatting.

Additional context

Originally reported here: https://github.com/bitnami/charts/issues/27082

michaelklishin commented 1 week ago

It was not "deleted without notice", it was moved to a discussion since it was a question https://github.com/rabbitmq/rabbitmq-server/discussions/11546. The error returned by the OS was clearly explained to you.

This is not a bug. Only paths in rabbitmq.conf support validation. This has always been the case. You are welcome to contribute rabbitmq.conf support for the tracing plugin if you need it, this is the first such case in my 14 years around RabbitMQ.

The tracing plugin is only meant to be used in development environments and likely will be removed for 4.x because Wireshark and similar tools are superior in almost every way in production environments.

michaelklishin commented 1 week ago

@razvanphp see https://github.com/rabbitmq/rabbitmq-server/issues/11554 which is more specific about what can be done. We will not be adding path validations outside of rabbitmq.conf since well over 90% of settings can be configured there (or exposed to rabbitmq.conf, in the case of plugins).

You are welcome to contribute rabbitmq.conf support for tracing. This is open source software you very likely get for free, after all. Smaller plugins can be used as an example.

Note that schema extensions have test suites usually named config_schema_SUITE that can be run with Make with

# this is an example
cd deps/rabbitmq_trust_store
gmake ct-config_schema

# open the results
open logs/index.html
razvanphp commented 1 week ago

Thank you very much for taking the time to explain the context, I also took the time to investigate this issue and I was frustrated that the issue disappeared, did not get any notification from github discussion indeed, my bad.

As you noticed, the bitnami chart created the premise for this bug to arise, for me and at least another person who opened the issue, so I'm glad it's sorted out, up until the plugin will be deprecated.