Comments (9)
The two danger zones:
- https://github.com/rabbitmq/amqp091-go/blob/main/connection.go#L413
- https://github.com/rabbitmq/amqp091-go/blob/main/channel.go#L104
I replaced both with a select statement to see if it runs great, I assumed it would break something else, I don't know if it did, but at least it does not hang anymore ....
select {
case <-time.After(time.Second * 5):
break
case c <- err:
break
}
from amqp091-go.
I think that the issue is the channel that is notified about channel close is no longer being used to catch the amqpError in my code, at that time the channel has been initiated ... and so notifying a channel that is not listening in Golang hangs ... very hard problem in Golang, I am not sure if you would ever fix this, or tag it as working as expected, but well ... IMO frameworks should never hang forever even if they are misused.
from amqp091-go.
Thank you for reporting this issue. Deadlocks are something worth looking into. I'll keep this issue around to have a look at some point in the coming days.
from amqp091-go.
This issue is very close to #18.
Both describe the same behavior.
from amqp091-go.
Up-voting - burnt 2hrs yesterday on this. Might give client ability to unsubscribe, but best relieve them and avoid the deadlock by non-blocking write as suggested above.
from amqp091-go.
@remster You can not unsubscribe, as soon as you call NotifyClose, the framework will take that chan
, save it in its internal slice, and notify it when the RabbitMQ channel is closed, no matter what, you better have a listener on that chan
otherwise the framework will be signaling an "orphan" chan
leading to a deadlock.
from amqp091-go.
Also running into this one and it really is the same as #18.
As already suggested in #18, I would also make the library notification code non blocking by using the idiomatic non blocking select:
select {
case c <- err:
default:
}
I think the amqp091-go
library should not deadlock at all in this case. Not causing a deadlock is definitely preferred over caring if the user of the library receives proper alerts on shutdown, that really should be the users care but the documentation/examples should explain that.
If the idea is that the user of the library must properly subscribe to the connClose and chanClose notifications, then we should somehow implement these checks in the library so that the user will be made aware of this expectation.
But not deadlocking still seems preferable to me.
Edit: beginning to get a better understanding of the issue. With this new insight, what I said above is not the right solution. The examples should be better on how to handle things. I'll make sure to post some code when I'm done testing.
from amqp091-go.
As for comment in #18, I'll cose this one as the issue seems the same.
from amqp091-go.
As for comment in #18, I'll cose this one as the issue seems the same.
from amqp091-go.
Related Issues (20)
- channel.Confirm(true) hangs
- Add a constant for CQ version
- Use of buffered delivery channels when prefetch_count is not null HOT 7
- Add a constant to set consumer timeout as queue argument
- Test failure on 32bit architectures HOT 1
- The server name and version could not be captured by using tls.ConnectionState HOT 1
- The ctx parameter in the PublishWithDeferredConfirmWithContext method does not have a contextual effec HOT 4
- Package panics at connection.Channel HOT 1
- connection block when write connection reset by peer HOT 7
- Method amqp.Connection.Channel() is blocked for infinity while there is no Internet HOT 13
- concurrent dispatch data race HOT 3
- Messages don't do ack HOT 3
- Inconsistent documentation HOT 1
- Import error while using in a Traefik plugin HOT 1
- Channel Notify Close not receive event when connection is closed by RMQ server. HOT 1
- Add mutex guard to Channel methods HOT 6
- Allow us to add queue sub to existing consumer
- add better debug information on DialConfig HOT 2
- pause consuming with auto ack true / rate limit with with auto ack true
- republishing on reconnect bug in the example HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amqp091-go.