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

Enforce/honor per-vhost queue limit for all protocols #11222

Merged
merged 5 commits into from
May 21, 2024

Conversation

SimonUnge
Copy link
Collaborator

@SimonUnge SimonUnge commented May 13, 2024

Proposed Changes

The current vhost queue limit it's only applicable to AMQP 0.9.1 and "non-native" protocols.

This PR moves the check to rabbit_queue_type:declare

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.

@SimonUnge SimonUnge force-pushed the move_vhost_limit_check branch 2 times, most recently from 724c60b to 7b21b48 Compare May 13, 2024 17:55
@SimonUnge SimonUnge marked this pull request as ready for review May 13, 2024 19:29
@michaelklishin michaelklishin changed the title Move the check to be called on all queue types Enforce/honor per-vhost queue limit for all protocols May 14, 2024
@michaelklishin michaelklishin merged commit f124bca into rabbitmq:main May 21, 2024
11 checks passed
michaelklishin added a commit that referenced this pull request May 21, 2024
Enforce/honor per-vhost queue limit for all protocols (backport #11222)
@ansd
Copy link
Member

ansd commented May 22, 2024

This PR adds a regression: rabbit_vhost_limit:is_over_queue_limit/1 is now called twice for MQTT connections:

case rabbit_vhost_limit:is_over_queue_limit(VHost) of
false ->
rabbit_core_metrics:queue_declared(QName),
Q0 = amqqueue:new(QName,
none,
_Durable = true,
_AutoDelete = false,
QOwner,
QArgs,
VHost,
#{user => Username},
QType),
case rabbit_queue_type:declare(Q0, node()) of
{new, Q} when ?is_amqqueue(Q) ->
rabbit_core_metrics:queue_created(QName),
{ok, Q};
Other ->
?LOG_ERROR("Failed to declare ~s: ~p",
[rabbit_misc:rs(QName), Other]),
{error, queue_declare}
end;
{true, Limit} ->
?LOG_ERROR("cannot declare ~s because "
"queue limit ~p in vhost '~s' is reached",
[rabbit_misc:rs(QName), Limit, VHost]),
{error, queue_limit_exceeded}
end

@SimonUnge
Copy link
Collaborator Author

@ansd Hmmm, totally missed that check. It would only check if twice with a 'false' result I guess... Although something could slip in-between perhaps. I can update the mqtt_processor code to just handle the protocol error return value of rabbit_queue_type:declare?

@ansd
Copy link
Member

ansd commented May 22, 2024

I can update the mqtt_processor code to just handle the protocol error return value of rabbit_queue_type:declare?

That would be great, thank you!

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

4 participants