Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18871

camel-netty - Application does not recover (threads are WAITING) when NettyProducer pool is exhausted

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      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).

       

      from("direct:start")
      .to("netty://tcp://localhost:18667?connectTimeout=500&decoders=#myDecoders&encoders=#myEncoders&producerPoolMaxTotal=10&producerPoolMinEvictableIdle=-1&requestTimeout=250&sync=true");
      

       

       

      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.

       

      "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)

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            vincenzo.galluccio Vincenzo Galluccio
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: