Skip to content

AMQ-9118 - Wake pull consumer when a duplicate delivery is suppressed - #2761

Open
mylesmac12 wants to merge 1 commit into
apache:mainfrom
mylesmac12:AMQ-9118
Open

mylesmac12 wants to merge 1 commit into
apache:mainfrom
mylesmac12:AMQ-9118

Conversation

@mylesmac12

@mylesmac12 mylesmac12 commented Oct 26, 2026 •

Copy link
Copy Markdown

Fixes AMQ-9118

With prefetch=0 a deadlock occurs between the client and broker upon receiving a duplicate message. receive() sends the broker a pull request (asking for one message) then calls ActiveMQMessageConsumer#dequeue(-1) which sleeps (with no timeout set) until something is put in the local buffer. The broker responds with a message if available; if no message is available within the timeout the “nothing” signal is returned. Either of these messages are put in the buffer by the client, wakes the sleeping thread, and continues the loop.

During the pull of the first instance of the duplicated message, the broker sends the message, the client checks it and puts it in the buffer, the listener thread wakes, and the loop calls receive() again. During the pull of the second instance of the duplicated message, the broker sends the message again. The client notices it’s a duplicate, logs …suppressing duplicate delivery on connection, and discards the message without putting any message in the buffer. The waiting thread (from dequeue(-1)) is never woken: no “nothing” was sent (as a message was sent but discarded) and nothing appears in the buffer. The deadlock: client’s listener thread awaits something to land in the buffer, and the broker awaits the next explicit pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant