-
Notifications
You must be signed in to change notification settings - Fork 139
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
deadlocks in Channel.call(...)
#253
Comments
Thanks for the report and the steps to reproduce this issue. I can reproduce it. As you noted, it requires a blocked RabbitMQ to reproduce. |
Channel.call(...)
Channel.call(...)
I'm pretty sure I got the something similaron |
Lack of timeout feature felt in all pkg methods. I saw almost all of the func (ch *Channel) PublishWithContext(ctx context.Context, exchange, key string, mandatory, immediate bool, msg Publishing) error {
err := make(chan error)
go func() {
err <- ch.Publish(exchange, key, mandatory, immediate, msg)
}()
select {
case <-ctx.Done():
return fmt.Errorf("context cancelled")
case e := <-err:
return e
}
} |
Implementing correct context cancelation is not trivial. Also your example is not correct, because you will (potentially) be leaking goroutines upon context cancelation. |
Describe the bug
Hi,
I'm (still) developing a wrapper for this library.
I'm trying to properly implement flow control and context handling and trying to test as much as possible, simulating connection loss and more.
For one of my tests I have a rabbitmq which is out of memory upon startup which triggers the connection blocking state.
This state seems to trigger some weird deadlocks or something along the lines in this library making this select statement block "forever":
amqp091-go/channel.go
Lines 181 to 205 in a2fcd5b
I have seen
Channel.Close()
andChannel.UnbindQueue(...)
block "forever".The blocking of
Channel.UnbindQueue(...)
is reproduced in the test below.Might be related to #225 (it might be possible to reproduce "turn off the internet" with the tool that I use for my tests that's called toxiproxy)
Reproduction steps
Here is a test that reproduces the problem:
make environment
https://github.com/jxsl13/amqpx/blob/feat/the-context-update/pool/session_test.go#L732-L885https://github.com/jxsl13/amqpx/blob/main/pool/session_test.go#L682-L837Expected behavior
QueueBind worked, so I guess QueueUnbind should also work.
I think this behavior can be triggered for nearly every method of
Channel
.Additional context
Should not be relevant but could:
darwin/arm64
macOS 14.3.1
The text was updated successfully, but these errors were encountered: