-
Notifications
You must be signed in to change notification settings - Fork 140
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
Check if channel is nil before updating it #150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your submission.
If channel
is nil
at this spot, it seems to be indicative of a bug somewhere else that I would like to track down, rather than just checking for nil
.
Is there a reliable way to reproduce this scenario?
I need to investigate a bit further, but telling from the logs, the following might have happened:
|
I doubt that https://github.com/go-redis/redis is a wrapper for this library. In addition, the 404 exception in your example would not close the connection as it is a channel exception. No new frames would be sent on this channel but it could that there were some in flight. So the improvement would be: drop frames for channels that are not currently open (that the client knows of) with a warning, several other clients do something like that. |
Sorry, copied the wrong link 🤦♂️ |
Use map existence
@julienschmidt thanks again for your pull request. Considering that the channel is checked for |
In observed the following panic in the wild:
Trying to understand what happens, it turns out the nil pointer deference here https://github.com/rabbitmq/amqp091-go/blob/v1.5.0/channel.go#L94 actually seems the be caused by the map access here https://github.com/rabbitmq/amqp091-go/blob/v1.5.0/connection.go#L538, which returns
nil
if the key doesn't exist / the map is empty.Thus, a check whether the channel is nil is missing.