Skip to content

QueueingConsumer.nextDelivery can hang forever, even if the underlying connection dies #9

Closed
@swenson

Description

@swenson

When calling nextDelivery to grab the next message from QueueingConsumer, it is calling the blocking method on the queue, take(), which will block forever.

https://github.com/rabbitmq/rabbitmq-java-client/blob/master/src/com/rabbitmq/client/QueueingConsumer.java#L215

The problem occurs then if the underlying channel dies, then the thread that called nextDelivery will now be waiting forever.

The solution we had to in our code that uses this was to use the timeout version, and manually check if the channel had closed while we were waiting every time.

Possible solution: make both versions of nextDelivery use a timeout (and spin in the case of the no-timeout version), check if the channel died, and throw a ShutdownSignalException in that case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions