[
https://issues.apache.org/jira/browse/CAMEL-18871?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-18871.
---------------------------------
Fix Version/s: 4.0
Resolution: Fixed
Thanks for the PRs
> camel-netty - Application does not recover (threads are WAITING) when
> NettyProducer pool is exhausted
> -----------------------------------------------------------------------------------------------------
>
> Key: CAMEL-18871
> URL: https://issues.apache.org/jira/browse/CAMEL-18871
> Project: Camel
> Issue Type: Bug
> Components: camel-netty
> Affects Versions: 3.14.7
> Reporter: Vincenzo Galluccio
> Priority: Major
> Fix For: 3.14.8, 3.18.5, 3.20.2, 3.21.0, 4.0
>
>
> When the Camel Application sends a LOT of requests to a TCP/IP Server (which
> is not available/down) using Netty component, after a bit, it hangs because
> the Producer Pool is exhausted (when *producerPoolMaxTotal* is not -1).
>
> {code:java}
> from("direct:start")
> .to("netty://tcp://localhost:18667?connectTimeout=500&decoders=#myDecoders&encoders=#myEncoders&producerPoolMaxTotal=10&producerPoolMinEvictableIdle=-1&requestTimeout=250&sync=true");
> {code}
>
>
> In previous version 3.14.1 the behavior was to fail when Pool was exhausted
> ({*}GenericObjectPool.{*}{*}WHEN_EXHAUSTED_FAIL{*}), however since version
> 3.14.2 and the migration to `{*}org.apache.commons:commons-pool2{*}`
> (https://issues.apache.org/jira/browse/CAMEL-17461) the default has become to
> block.
>
> The proposal is to adjust
> `[https://github.com/apache/camel/blob/camel-3.14.7/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java]
> ` , method `doStart()` to add optionally set the *BlockWhenExhausted* flag
> (BaseGenericObjectPool.setBlockWhenExhausted) and the
> *{{borrowMaxWaitMillis}}* parameters.
>
> {code:java}
> "Camel Thread #74 - NettyClientTCPWorker" #1166 prio=5 os_prio=0
> tid=0x00007fd661a1d800 nid=0x18599 waiting on condition [0x00007fd5ffb12000]
> java.lang.Thread.State: WAITING (parking)
> at sun.misc.Unsafe.park(Native Method)
> - parking to wait for <0x00000005ce0e8338> (a
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
> at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
> at
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
> at
> org.apache.commons.pool2.impl.LinkedBlockingDeque.takeFirst(LinkedBlockingDeque.java:1323)
> at
> org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:306)
> at
> org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:223)
> at
> org.apache.camel.component.netty.NettyProducer.processWithBody(NettyProducer.java:259)
> at
> org.apache.camel.component.netty.NettyProducer.process(NettyProducer.java:228)
> at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:172)
> at
> org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:398){code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)