Claus Ibsen created CAMEL-24124:
-----------------------------------

             Summary: camel-jms: InOut exchanges in-flight during shutdown have 
AsyncCallback never completed - causes 45s graceful-shutdown stall
                 Key: CAMEL-24124
                 URL: https://issues.apache.org/jira/browse/CAMEL-24124
             Project: Camel
          Issue Type: Bug
          Components: camel-jms
            Reporter: Claus Ibsen


When a JMS producer is stopped while InOut exchanges are awaiting replies, the 
pending AsyncCallbacks are never completed. This causes the shutdown 
orchestrator to wait the full graceful-shutdown timeout (default 45 seconds) 
before force-stopping.

Two compounding problems:

1. {{DefaultTimeoutMap.doStop()}} (core module) calls {{map.clear()}} without 
emitting eviction events. The {{CorrelationTimeoutMap}} listener that would 
call {{ReplyHandler.onTimeout() -> processReply() -> callback.done()}} never 
fires. Pending reply handlers are silently discarded.

2. {{ReplyManagerSupport.processReply()}} guards with {{if (!isRunAllowed()) 
return}}. Even if problem 1 were fixed, once the service is stopping, 
{{processReply}} early-returns and the callback is never completed.

The fix should either:
- Drain pending replies during stop: iterate the map, fail each with a 
"shutting down" exception, and complete callbacks
- Or relax the {{isRunAllowed()}} guard to allow reply completion during the 
stopping phase

Both camel-jms and camel-sjms have the same pattern.

This is long-standing design debt (since ~2010), originally noted as M7 in the 
camel-jms/camel-amqp code review umbrella CAMEL-24078.

Related: CAMEL-24073 (send-failure double-callback) is on a different code path 
and does not address this.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to