Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.7.1
-
None
-
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?