shashank created CAMEL-27172:
--------------------------------
Summary: camel-netty - requestTimeout is lost after the first
reply on a channel used without the producer pool (producerPoolEnabled=false,
reuseChannel=true)
Key: CAMEL-27172
URL: https://issues.apache.org/jira/browse/CAMEL-27172
Project: Camel
Issue Type: Bug
Components: camel-netty
Reporter: shashank
Assignee: shashank
h3. What happens
With {{sync=true}} and {{requestTimeout}}, the producer relies on a
{{ReadTimeoutHandler}} named {{timeout}} in the channel pipeline.
{{ClientChannelHandler.channelRead0}} removes it when a reply arrives, and only
{{activateObject}} of the producer pool adds it again, when a channel is
borrowed from the {{GenericObjectPool}} (added by CAMEL-14363).
Two documented ways use a channel again without that borrow:
* {{producerPoolEnabled=false}}: {{SharedSingletonObjectPool}} returns the same
channel and never calls {{activateObject}};
* {{reuseChannel=true}}: the second and later calls of the same exchange take
the channel from the exchange property.
So every request after the first one on that channel has no timeout: if the
server does not answer, the caller waits for ever (the default correlation
manager has no timeout of its own). The {{CamelNettyRequestTimeout}} header
still works, as it adds the handler for the request.
h3. How to reproduce
{{NettyRequestTimeoutReusedChannelTest}} (camel-netty): a server that answers
"Hello Camel" late; with {{producerPoolEnabled=false}}, "Hello" then "Hello
Camel" on the same endpoint; and a route that calls the endpoint twice with
{{reuseChannel=true}}. The second request gets the late reply instead of a
{{ReadTimeoutException}}.
h3. Fix
When a sync request is sent and the channel has no {{timeout}} handler, the
producer adds one with the configured {{requestTimeout}}.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)