You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Vincenzo Galluccio (Jira)" <ji...@apache.org> on 2023/01/09 15:36:00 UTC
[jira] [Updated] (CAMEL-18871) Application does not recover (threads are WAITING) when NettyProducer pool is exhausted
[ https://issues.apache.org/jira/browse/CAMEL-18871?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vincenzo Galluccio updated CAMEL-18871:
---------------------------------------
Description:
When the Camel Application tries to send 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}
was:
When the Camel Application tries to send 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}
> 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
>
>
> When the Camel Application tries to send 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)