amqp: Channels do not have a per-operation timeout
Hi,
I think I’ve found a bug with Connection.Channel(): sometimes the call is blocked indefinitely.
My scenario: I’ve got a queue in a vhost. I start to consume on this queue. Then I delete the vhost from the RabbitMQ web interface. Obviously, the channel is closed.
In my code, I retry in an infinite loop to open a new channel, then to consume on this channel.
Consume() returns an error:
Exception (403) Reason: "ACCESS_REFUSED - access to queue 'xxxx' in vhost 'xxxx' refused for user 'guest'" (it’s expected)
After a few seconds, my program is blocked indefinitely.
I think that the RabbitMQ server has closed the connection from its side, because I don’t see the connection in the web interface anymore. Nothing relevant in the logs.
Here is the stack trace for the goroutine:
goroutine 34 [select]:
github.com/streadway/amqp.(*Channel).call(0xc42025b8c0, 0xa43020, 0xc4202690b0, 0xc42044bd70, 0x1, 0x1, 0x1, 0xc4203074a0)
github.com/streadway/amqp/channel.go:176 +0x198
github.com/streadway/amqp.(*Channel).open(0xc42025b8c0, 0xc42025b8c0, 0x0)
github.com/streadway/amqp/channel.go:165 +0xb3
github.com/streadway/amqp.(*Connection).openChannel(0xc420295a40, 0xc420024600, 0x77e7a0, 0x8a2480)
github.com/streadway/amqp/connection.go:624 +0x55
github.com/streadway/amqp.(*Connection).Channel(0xc420295a40, 0xa42820, 0xc42033b4c0, 0xc420295a40)
github.com/streadway/amqp/connection.go:646 +0x2b
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 9
- Comments: 23 (3 by maintainers)
Hello! I have almost the same problem. But it seems not to be connected with vhost deletion. This is my environement: RabbitMQ 3.6.10, Erlang 19.3, topic exchange.
I want to publish a message, and almost every time I call connection.Channel() the program hangs in
github.com/streadway/amqp/channel.go:176 +0x44aThis bug is unstable, investigate please. May be line 176 is not the place that need to be fixed and the error in some other place.By the way with
RabbitMQ 3.6.6, Erlang 19.2driver works fine.@coyle when someone contributes a fix and we accept it. There is a snippet above that demonstrates roughly what should be done (or at least what several other clients do). Feel free to turn that into a pull request and test it with your workload.