shashank created CAMEL-27173:
--------------------------------

             Summary: camel-netty - an error or a message on an idle pooled 
channel is set on the exchange of the last request of that channel
                 Key: CAMEL-27173
                 URL: https://issues.apache.org/jira/browse/CAMEL-27173
             Project: Camel
          Issue Type: Bug
          Components: camel-netty
            Reporter: shashank
            Assignee: shashank


h3. What happens

{{DefaultNettyCamelStateCorrelationManager}} keeps the state (exchange and 
callback) of the last request of a channel until the channel is closed. After 
the reply the channel goes back to the producer pool, and the exchange routes 
on. When the server then resets the idle connection (an idle timeout with 
SO_LINGER 0, a load balancer, a restart), 
{{ClientChannelHandler.exceptionCaught}} gets that old state and sets the 
exception on the exchange, which has already completed its call: the exchange 
fails with "Connection reset by peer" at its next step, although its call 
succeeded (with redelivery, that next step runs again). A message that the 
server sends on the idle channel replaces the message of that exchange the same 
way ({{channelRead0}}). {{channelInactive}} already checks that the state is 
not done; these two paths do not.

This needs the exchange to route on asynchronously after the call (another 
netty call, a threads or async delay step, an async producer); with only 
synchronous steps they run on the event loop of the channel before it reads the 
reset.

h3. How to reproduce

{{NettyProducerIdleChannelResetTest}} (camel-netty): a server replies, then 
resets the connection while the exchange runs its next step; the exchange fails 
with the reset.

h3. Fix

{{ClientChannelHandler}} treats a done state as no state: an exception closes 
the channel without touching the exchange, and a message is ignored.

_Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to