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

Handle and propagate protocol exceptions in channel interceptors to the calling parent channels #9459

Merged
merged 1 commit into from Sep 19, 2023
Merged

Handle and propagate protocol exceptions in channel interceptors to the calling parent channels #9459

merged 1 commit into from Sep 19, 2023

Conversation

Ayanda-D
Copy link
Contributor

Proposed Changes

Channel interceptor behaviour rabbit_channel_interceptor allows us to return #amqp_error{}
however there times when we also want to (fail fast) and throw, or exit an amqp_error directly
from the channel interceptor callback. For instance, when using equivalence helpers in custom
interceptor callbacks: rabbit_misc:assert_field_equivalence/4 (see dummy_interceptor).

The rabbit_channel_interceptor does a catch on callback exceptions (at least for undef) and
handles AMQP method and content as normal. At this point, we also want to be able to catch protocol
exceptions and pass on the exit to the calling/parent channel process. Gives us some extensibility
on custom interceptor callbacks in handling and processing some common protocol exceptions.

(Really need this for something we're working on 😬)

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.

@michaelklishin
Copy link
Member

I don't see much risk in accepting this, although we touch channel interceptors so rarely that it's also difficult to assess :)

@michaelklishin michaelklishin merged commit 343e593 into rabbitmq:main Sep 19, 2023
10 checks passed
@Ayanda-D
Copy link
Contributor Author

Cheers :)
🎉

@Ayanda-D Ayanda-D deleted the propagate-protocol-exceptions-in-channel-interceptors branch September 19, 2023 15:06
@Ayanda-D
Copy link
Contributor Author

we also now avoid these crashes on the channel. so thank you from our side, low risk merge goes a long way ☺️
https://gist.github.com/Ayanda-D/038d815a0866412dd3bff1113c3170e9

michaelklishin added a commit that referenced this pull request Sep 19, 2023
Handle and propagate protocol exceptions in channel interceptors to the calling parent channels (backport #9459)
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.

None yet

2 participants