You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/06/20 17:21:19 UTC

[camel] branch camel-3.14.x updated: CAMEL-18027: camel-netty (producer) wrongly closes client channels due to request timeout being triggeted during eviction run

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-3.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.14.x by this push:
     new f3364deebb1 CAMEL-18027: camel-netty (producer) wrongly closes client channels due to request timeout being triggeted during eviction run
f3364deebb1 is described below

commit f3364deebb1df1af0febada22fd1a498a43a78de
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 20 19:20:43 2022 +0200

    CAMEL-18027: camel-netty (producer) wrongly closes client channels due to request timeout being triggeted during eviction run
---
 .../main/java/org/apache/camel/component/netty/NettyProducer.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
index 44c795a5eaf..8b96ef3e27f 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
@@ -57,6 +57,7 @@ import org.apache.camel.util.IOHelper;
 import org.apache.commons.pool2.ObjectPool;
 import org.apache.commons.pool2.PooledObject;
 import org.apache.commons.pool2.PooledObjectFactory;
+import org.apache.commons.pool2.PooledObjectState;
 import org.apache.commons.pool2.impl.DefaultPooledObject;
 import org.apache.commons.pool2.impl.GenericObjectPool;
 import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
@@ -113,8 +114,8 @@ public class NettyProducer extends DefaultAsyncProducer {
             config.setMaxIdle(configuration.getProducerPoolMaxIdle());
             // we should test on borrow to ensure the channel is still valid
             config.setTestOnBorrow(true);
-            // only evict channels which are no longer valid
-            config.setTestWhileIdle(true);
+            // idle channels can be evicted
+            config.setTestWhileIdle(false);
             // run eviction every 30th second
             config.setTimeBetweenEvictionRuns(Duration.ofSeconds(30));
             config.setMinEvictableIdleTime(Duration.ofMillis(configuration.getProducerPoolMinEvictableIdle()));
@@ -610,8 +611,9 @@ public class NettyProducer extends DefaultAsyncProducer {
             ChannelFuture channelFuture = p.getObject();
             LOG.trace("activateObject channel request: {}", channelFuture);
 
+            PooledObjectState state = p.getState();
             if (channelFuture.isSuccess() && producer.getConfiguration().getRequestTimeout() > 0) {
-                LOG.trace("reset the request timeout as we activate the channel");
+                LOG.trace("Reset the request timeout as we activate the channel");
                 Channel channel = channelFuture.channel();
 
                 ChannelHandler handler = channel.pipeline().get("timeout");