Coder Social home page Coder Social logo

Comments (9)

melardev avatar melardev commented on May 22, 2024

The two danger zones:

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.

melardev avatar melardev commented on May 22, 2024

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.

Zerpet avatar Zerpet commented on May 22, 2024

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.

andygrunwald avatar andygrunwald commented on May 22, 2024

This issue is very close to #18.
Both describe the same behavior.

from amqp091-go.

remster avatar remster commented on May 22, 2024

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.

melardev avatar melardev commented on May 22, 2024

@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.

malc0mn avatar malc0mn commented on May 22, 2024

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.

DanielePalaia avatar DanielePalaia commented on May 22, 2024

As for comment in #18, I'll cose this one as the issue seems the same.

from amqp091-go.

DanielePalaia avatar DanielePalaia commented on May 22, 2024

As for comment in #18, I'll cose this one as the issue seems the same.

from amqp091-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.