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

Using netty-http with enricher causes buffer leak

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      NettyHttpProducer depends on onCompletion synchronization do release allocated buffer. However content enricher could create exchanges without UnitOfWork. Here is example unit test to reproduce issue:

      EnricherIssueTest.java
      public class EnricherIssueTest extends CamelTestSupport {
      
          @Test
          public void leakTest() {
              ResourceLeakDetector.setLevel(Level.PARANOID);
              for (int i = 0; i < 10; ++i) {
                  template.requestBody("direct:outer", "input", String.class);
              }
          }
      
          @Override
          protected RoutesBuilder createRouteBuilder() throws Exception {
              return new RouteBuilder() {
      
                  @Override
                  public void configure() throws Exception {
                      ResourceLeakDetector.setLevel(Level.PARANOID);
      
                      final int port = AvailablePortFinder.getNextAvailable();
      
                      from("netty-http:http://localhost:" + port + "/test")
                          .transform().simple("${body}");
      
                      from("direct:outer")
                          .enrich("netty-http:http://localhost:"+ port + "/test?disconnect=true",
                              AggregationStrategies.string(), false, false);
                  }
              };
          }
      }
      

      Setting shareUnitOfWork=true on enrich() causes snippet to behave correctly.
      I'm not sure where is the bug. Does Enricher is allowed to create exchanges without UOW? Maybe org.apache.camel.component.netty.http.NettyHttpProducer should create UOW if none is available? Or maybe my usage is wrong?

       

       

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            karbi Michał Ostrowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: