Michał Ostrowski created CAMEL-16091:
----------------------------------------

             Summary: Using netty-http with enricher causes buffer leak
                 Key: CAMEL-16091
                 URL: https://issues.apache.org/jira/browse/CAMEL-16091
             Project: Camel
          Issue Type: Bug
          Components: came-core, camel-netty-http
    Affects Versions: 3.7.1
            Reporter: Michał Ostrowski


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:
{code:java|title=EnricherIssueTest.java|borderStyle=solid}
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);
            }
        };
    }
}
{code}
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?

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to