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

Re-use channel ids? #121

Open
eandersson opened this issue Apr 14, 2020 · 1 comment
Open

Re-use channel ids? #121

eandersson opened this issue Apr 14, 2020 · 1 comment

Comments

@eandersson
Copy link

I remember troubleshooting a bug report for amqpstorm and looking at rabbitpy as a reference at the time I believe that it suffers from the same issue
eandersson/amqpstorm#55

I believe that we should be re-using the id of previously closed channels. This is at least what pika does, and has been working great for amqpstorm.

@eblis
Copy link

eblis commented Oct 16, 2020

I think we've hit a problem with the way RabbitPy uses channels and their IDs.

We have a piece of code that connects to a RabbitMQ instance and receives a message - it does so by creating a new channel then, when the processing is done closing everything (uses the channel in a with statement)
The problem is that after about 1024 or 2048 calls RabbitPy crashes saying that there are too many channels.

The relevant piece of code is this:

        if not self._channels:
            return 1
        if self._max_channel_id == self._channel0.maximum_channels:
            raise exceptions.TooManyChannelsError
        return self._max_channel_id + 1

I can see that the max_channel_id is incremented when a new channel is created but I don't see it ever getting decremented.
Shouldn't the max_channel_id go down if a channel is no longer used ? Should the max_channel_id be allowed to go over the maximum_channels value as long as open channels count is still below ?

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

2 participants