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

Invalid Pool Exhausted error on camel-netty4

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.17.4, 2.18.0, 2.19.0, 2.20.0, 2.20.1
    • Fix Version/s: 2.19.5, 2.20.2, 2.21.0, 2.18.6
    • Component/s: camel-netty4
    • Labels:
      None
    • Environment:

      Same behaviour on : Linux, Windows 7, AIX
      Using Intelli-J

    • Estimated Complexity:
      Novice
    • Regression:
      Regression
    • Flags:
      Important

      Description

      Hey guys,

      Since camel 2.17.4, our application who made some "ping request" brings a "Pool exhausted" error after 100 trying.

      After analysis, since 2.17.4, when camel-netty4 try to connect to a down host, the connection (ChannelFuture) stay in the pool.

      Here is the code to show you :

      import org.apache.camel.CamelContext;
      import org.apache.camel.Exchange;
      import org.apache.camel.builder.RouteBuilder;
      import org.apache.camel.impl.DefaultCamelContext;
       
      import java.util.NoSuchElementException;
       
      public class main {
          public static void main(String args[]) throws Exception {
              CamelContext context = new DefaultCamelContext();
              context.addRoutes(new RouteBuilder() {
                  public void configure() {
                      onException(NoSuchElementException.class).process(exchange -> {
                          System.out.println(exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class));
                      });
       
                      from("timer://myTimer?period=2000").
                          setBody()
                              .simple("Trying to connect to localhost:12345")
                          .to("stream:out")
                          .to("netty4:tcp://localhost:12345?producerPoolMaxActive=4");
                  }
              });
              context.start();
              Thread.sleep(8000000);
          }
      }
      

      The producerPoolMaxActive is set to 4 to bring the error faster.

      The output in 2.17.3 just bellow (all work perfectly)

      _Trying to connect to localhost:12345
      Trying to connect to localhost:12345
      Trying to connect to localhost:12345
      Trying to connect to localhost:12345
      Trying to connect to localhost:12345
      ...._

      *But in version > 2.17.3, we've got this : *

      _Trying to connect to localhost:12345
      Trying to connect to localhost:12345
      Trying to connect to localhost:12345
      Trying to connect to localhost:12345
      Trying to connect to localhost:12345
      java.util.NoSuchElementException: Pool exhausted
      Trying to connect to localhost:12345
      java.util.NoSuchElementException: Pool exhausted
      Trying to connect to localhost:12345
      java.util.NoSuchElementException: Pool exhausted
      Trying to connect to localhost:12345
      java.util.NoSuchElementException: Pool exhausted
      _

      I've made a pull request to fix it.

      Thanks for your help !

        Attachments

          Activity

            People

            • Assignee:
              acosentino Andrea Cosentino
              Reporter:
              dvor4x dvor4x
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: