Skip to content

Prevent exchange logging crash #12100

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

Merged

Conversation

gomoripeti
Copy link
Contributor

Proposed Changes

Don't let the log callback of exchange_logging handler crash, because in case of a crash OTP logger removes the
exchange_logger handler (https://github.com/erlang/otp/blob/OTP-27.0/lib/kernel/src/logger_backend.erl#L54), which in turn deletes the log exchange and its bindings.

It was seen several times in production (even on 3.13.x) that the log exchange suddenly disappears and without debug logging there is no trace of why. (The OTP logger framework does print the details, but on debug level only https://github.com/erlang/otp/blob/OTP-27.0/lib/kernel/src/logger_backend.erl#L59)

With this commit erlang:display will print the reason and stacktrace to stderr without using the logging infrastructure.
This hopefully will give some hints about the root cause (which is still unknown)

Tested the change manually using meck to mock a crash of the logging for a certain log event.

Types of Changes

What types of changes does your code introduce to this project?
Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)
  • Build system and/or CI

Checklist

Put an x in the boxes that apply.
You can also fill these out after creating the PR.
If you're unsure about any of them, don't hesitate to ask on the mailing list.
We're here to help!
This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally with my changes
  • If relevant, I have added necessary documentation to https://github.com/rabbitmq/rabbitmq-website
  • If relevant, I have added this change to the first version(s) in release-notes that I expect to introduce it

Further Comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution
you did and what alternatives you considered, etc.

Don't let the `log` callback of exchange_logging handler crash,
because in case of a crash OTP logger removes the exchange_logger
handler, which in turn deletes the log exchange and its bindings.

It was seen several times in production that the log exchange suddenly
disappears and without debug logging there is no trace of why.

With this commit `erlang:display` will print the reason and stacktrace
to stderr without using the logging infrastructure.
@michaelklishin michaelklishin merged commit 868dbdc into rabbitmq:main Aug 23, 2024
323 of 326 checks passed
@gomoripeti gomoripeti deleted the prevent_exchange_logging_crash branch August 23, 2024 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants