Skip to content

Fix memory leak when using mandatory flag in CQs #3560

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
merged 1 commit into from
Oct 13, 2021

Conversation

lhoguin
Copy link
Contributor

@lhoguin lhoguin commented Oct 12, 2021

Proposed Changes

When the mandatory flag is used for publishing the channel would keep a lot of state in memory as if it was waiting for confirms, even though publisher confirms were not used. This affects v3.9.x and above and seems to have been introduced by the rabbit_queue_type refactoring.

I have confirmed via PerfTest that the problem is fixed. Example command to reproduce:

make run ARGS="--producers 1 --consumers 1 --flag mandatory --flag persistent --auto-delete false --qos 10 --queue 'q'"

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.

@lhoguin lhoguin force-pushed the lh-fix-mandatory-flag branch from 32e7ec5 to 10779d2 Compare October 12, 2021 13:26
@lhoguin lhoguin marked this pull request as ready for review October 12, 2021 13:49
@lhoguin lhoguin requested a review from kjnilsson October 13, 2021 09:50
@michaelklishin
Copy link
Collaborator

I could reproduce the leak in master and confirm the fix.

@lhoguin lhoguin force-pushed the lh-fix-mandatory-flag branch from 10779d2 to ddbe974 Compare October 13, 2021 12:01
@lhoguin
Copy link
Contributor Author

lhoguin commented Oct 13, 2021

I have pushed a fix for rabbitmq-diagnostics memory_breakdown reporting 0 for connection processes and added a small comment in the original commit to explain what is being fixed for future reference (only the commit message of the first commit has changed).

@lhoguin lhoguin force-pushed the lh-fix-mandatory-flag branch from ddbe974 to 40d2b4b Compare October 13, 2021 12:08
@lhoguin
Copy link
Contributor Author

lhoguin commented Oct 13, 2021

I have force pushed again to remove the second commit. I will open a separate PR because that issue also affects 3.8, unlike this PR's original issue.

MsgNo is defined for both mandatory flags and confirms,
but only confirms need to be kept track of in this module.
@lhoguin lhoguin force-pushed the lh-fix-mandatory-flag branch from 40d2b4b to 7ffb154 Compare October 13, 2021 12:14
@michaelklishin michaelklishin merged commit d48ed6d into master Oct 13, 2021
@michaelklishin michaelklishin deleted the lh-fix-mandatory-flag branch October 13, 2021 13:20
michaelklishin added a commit that referenced this pull request Oct 13, 2021
Fix memory leak when using mandatory flag in CQs (backport #3560)
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.

3 participants