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

Unbounded heap growth when consumer pool can't handle the load #603

Closed
leksito opened this issue Dec 7, 2020 · 2 comments
Closed

Unbounded heap growth when consumer pool can't handle the load #603

leksito opened this issue Dec 7, 2020 · 2 comments

Comments

@leksito
Copy link

leksito commented Dec 7, 2020

If the number of incoming messages is greater than the consumer is handling, the memory usage increases infinitely over time.
The simplest ruby ​​script can use a huge amount of memory

require 'bunny'

Process.setproctitle("test_consumer")

conn = Bunny.new(
# bunny conf
)
conn.start
channel = conn.create_channel

exchange = channel.send(:fanout, 'test')
queue = channel.queue('test_queue', exclusive: false)
queue.bind(exchange)

queue.subscribe do |*args|
  puts args.inspect[0..100]
  sleep 0.01 # mock message handling
end

Thread.list.reject { |t| t == Thread.current }.each(&:join)

1

and this memory is not released even after reducing the load

@leksito
Copy link
Author

leksito commented Dec 7, 2020

#604

@michaelklishin
Copy link
Member

This is expected. Consumers should use manual acknowledgements with a low enough prefetch value on their channels. This is the only fundamental solution.

@michaelklishin michaelklishin changed the title huge memory leak when consumer pool can't handle the load Unbounded heap growth when consumer pool can't handle the load Dec 8, 2020
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 a pull request may close this issue.

2 participants