shashank created CAMEL-27333:
--------------------------------

             Summary: camel-sjms - after the temporary reply queue's connection 
fails, an InOut request waits for the new queue with no timeout, and for ever 
when the producer stops
                 Key: CAMEL-27333
                 URL: https://issues.apache.org/jira/browse/CAMEL-27333
             Project: Camel
          Issue Type: Bug
          Components: camel-sjms
            Reporter: shashank
            Assignee: shashank


h3. What happens

With a temporary reply queue, when the connection of the reply listener fails, 
{{TemporaryReplyQueueExceptionListener}} marks the temporary queue for a 
refresh. Every InOut request then waits in 
{{TemporaryQueueReplyManager.getReplyTo()}} ({{destinationReady}}) until the 
connection recovery creates the new temporary queue. The wait is 
{{condition.await()}} without a timeout:

* when the producer is stopped during the wait, the listener container stops 
and cancels the recovery, and nothing signals the condition: the request thread 
waits for ever, holding the JMS connection and session opened by 
{{SjmsTemplate.send}}, and the exchange never completes. The request is not 
registered yet, so neither its requestTimeout nor the stop of the reply manager 
completes it;
* until the recovery has created the new temporary queue (it starts 1 s after 
the failure, then retries every recoveryInterval), every InOut request blocks 
in that wait, even when the broker is reachable again, instead of failing after 
requestTimeout.

The await has no loop either, so a spurious wakeup lets a request go on with 
the old queue.

h3. How to reproduce

After a first InOut request (which creates the reply manager), trigger the 
refresh of the temporary queue without a recovery, send an InOut request, and 
stop the producer: the request thread stays in {{destinationReady}} (WAITING) 
and its callback is never called.

Found with a TLA+ model of the sjms request/reply.

h3. Fix

Wait in a loop, at most the endpoint's requestTimeout, and stop waiting when 
the reply manager stops ({{TemporaryQueueReplyManager.doStop}} signals the 
waiters before the listener container stops). When the queue is not ready, 
{{getReplyTo()}} throws, and the producer completes the exchange with that 
exception without sending the request.

_Filed with Claude Code on behalf of allthingssecurity._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to