shashank created CAMEL-27334:
--------------------------------

             Summary: camel-netty - an exception on a pooled channel that no 
request uses yet keeps the next request on it from ever completing, even with 
requestTimeout
                 Key: CAMEL-27334
                 URL: https://issues.apache.org/jira/browse/CAMEL-27334
             Project: Camel
          Issue Type: Bug
          Components: camel-netty
            Reporter: shashank
            Assignee: shashank


h3. What happens

{{ClientChannelHandler.exceptionCaught}} sets {{exceptionHandled = true}} 
before it looks for the state of a request. When the channel has no state (an 
idle channel in the producer pool that no request used yet, or a channel just 
borrowed before {{putState}}), it returns without closing the channel, and the 
flag is only reset in {{channelActive}}. The next request on that channel then 
never completes:

* when its {{requestTimeout}} fires, {{exceptionCaught}} returns at the flag 
check, the {{ReadTimeoutHandler}} closes the channel, and {{channelInactive}} 
skips the callback because of the flag;
* when the server closes the connection without a reply, {{channelInactive}} 
skips the callback the same way.

CAMEL-27173 handled the case of a done state; the case of no state is left.

h3. How to reproduce

{{netty:tcp://host:port?textline=true&sync=true&lazyChannelCreation=false&decoderMaxLineLength=64&requestTimeout=1000}}:
 the server greets the channel opened at start with a line longer than 64 
characters (TooLongFrameException on the idle channel), then never answers the 
request: the exchange is not completed 5 seconds after the read timeout closed 
the channel.

Found with a TLA+ model of the netty producer.

h3. Fix

Set {{exceptionHandled}} only when a request's state was handled; an exception 
on a channel with no state is logged and leaves the flag alone.

_Filed with Claude Code on behalf of allthingssecurity._



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

Reply via email to