shashank created CAMEL-27335:
--------------------------------
Summary: camel-netty - stopping a producer that uses a
TimeoutCorrelationManagerSupport correlation manager leaves its pending
exchanges uncompleted
Key: CAMEL-27335
URL: https://issues.apache.org/jira/browse/CAMEL-27335
Project: Camel
Issue Type: Bug
Components: camel-netty
Reporter: shashank
Assignee: shashank
h3. What happens
When a netty producer stops, it closes its channels; {{channelInactive}} asks
the correlation manager for the state with {{getState(ctx, channel, (Throwable)
null)}}, which {{TimeoutCorrelationManagerSupport}} answers with {{null}}. The
manager is stopped next: {{DefaultTimeoutMap.doStop}} clears the map without
evicting the entries. The requests still waiting for a reply never get a
callback (a synchronous caller blocks, the exchange stays in flight).
The reply managers of camel-jms, camel-sjms and camel-rocketmq drain their
timeout map ({{drainAndEvictAll}}) on stop for this case.
Also, a request that the purge task evicts while the producer stops can be
submitted to the worker pool after the pool was shut down: its CallerRuns
policy drops the task, and the exchange is never completed.
h3. How to reproduce
A {{TimeoutCorrelationManagerSupport}} with a timeout of 60 s, a server that
reads the request and never replies, stop the producer: the callback is not
called 10 s after the stop. With the default correlation manager the exchange
completes with "No response received from remote server".
Found with a TLA+ model of the netty producer.
h3. Fix
The manager's timeout map evicts every pending entry when it stops (they
complete as timed out on the worker pool, before it is shut down), and an
eviction that reaches a shut-down (or missing) worker pool is completed in the
calling thread. The completion stays at most once (markDone).
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)