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

Temp (response) queue won't be auto-deleted due to channel remains open #6

Open
starkovv opened this issue Apr 13, 2015 · 1 comment

Comments

@starkovv
Copy link
Contributor

Am I right thinking that RR::Client#request

def request(queue, path, body, options = {})

does not close channel after it received response?

So the temporary queue won't be auto-deleted, as the connection (channel) is still open.

@starkovv
Copy link
Contributor Author

After some research I found out that rack-rabbit uses single channel for all its temp (response) queues.

On every sync request that rack-rabbit does, it creates temporary queue on RabbitMQ broker, and tells the broker to auto-destroy this queue right after the channel/connection to the broker will be closed.

It's fine if you instantiate new TCP connection to RabbitMQ every time you make synchronous request. So connection opened, temp queue created, actual request sent to exchange, response received from temp queue, connection closed, broker auto-deleted temp queue due to connection closed event. Done.

However, when you prefer to increase throughput and efficiency of your connection to RabbitMQ (in my case I've got 2x increase in throughput this way) and keep TCP connection open for further synchronous requests, that opened channel becomes a source of problems.

By keeping channel open, RabbitMQ does not see any reason to auto-delete created temp queue, so the temp queue for every request made will stay alive permanently. Thus, RabbitMQ will keep created and used temp queues until it overflow at some point.

To deal with this issue we need to manually delete temp queue right after we receive response from that queue.

To fix this it needs to add reply_queue.delete(if_empty: true) right before this line

condition.signal

Pull request will follow.

starkovv added a commit to starkovv/rack-rabbit that referenced this issue Apr 14, 2015
jakesgordon added a commit that referenced this issue Jul 26, 2017
Fix Issue #6. Added manual removal of temporary queue on synchronous req...
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

No branches or pull requests

1 participant