[
https://issues.apache.org/jira/browse/CAMEL-9195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14946455#comment-14946455
]
Claus Ibsen commented on CAMEL-9195:
------------------------------------
Fixed the leak and need to merge to 2.16.x branch when its there.
There is also new options to configure the channel for keep alive and tcp no
delay and so on.
> Memory leak in UndertowProducer
> -------------------------------
>
> Key: CAMEL-9195
> URL: https://issues.apache.org/jira/browse/CAMEL-9195
> Project: Camel
> Issue Type: Bug
> Components: camel-undertow
> Affects Versions: 2.16.0
> Reporter: James Netherton
> Assignee: Claus Ibsen
> Fix For: 2.17.0, 2.16.1
>
>
> The UndertowProducer class leaks memory over time due to the repeated
> creation of ByteBufferSlicePool for each HTTP client request. My
> understanding of this class is that instances of it should be limited and
> cached if possible.
> Here's an example RouteBuilder to replicate the issue. In a short time it
> will result in an OutOfMemoryError.
> {code}
> public class UndertowRouteBuilder extends RouteBuilder {
> @Override
> public void configure() throws Exception {
>
> from("undertow:http://localhost:8080/test").to("log:undertow?showAll=true");
> from("timer:foo?period=5000").transform(constant("hello
> world")).to("undertow:http://localhost:8080/test");
> }
> }
> {code}
> {code}
> org.apache.camel.CamelExecutionException: Exception occurred during execution
> on the exchange: Exchange[ID-worklaptop-50317-1444141557043-2-30][Message:
> hello world]
> at
> org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1658)
> at
> org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:345)
> at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:156)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
> at
> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:165)
> at
> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:73)
> at java.util.TimerThread.mainLoop(Timer.java:555)
> at java.util.TimerThread.run(Timer.java:505)
> Caused by: java.lang.OutOfMemoryError: Direct buffer memory
> at java.nio.Bits.reserveMemory(Bits.java:658)
> at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:123)
> at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:311)
> at org.xnio.BufferAllocator$2.allocate(BufferAllocator.java:57)
> at org.xnio.BufferAllocator$2.allocate(BufferAllocator.java:55)
> at org.xnio.ByteBufferSlicePool.allocate(ByteBufferSlicePool.java:143)
> at
> io.undertow.client.http.HttpRequestConduit.processWrite(HttpRequestConduit.java:98)
> at
> io.undertow.client.http.HttpRequestConduit.write(HttpRequestConduit.java:460)
> at
> io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.write(AbstractFixedLengthStreamSinkConduit.java:106)
> at
> org.xnio.conduits.ConduitStreamSinkChannel.write(ConduitStreamSinkChannel.java:150)
> at
> io.undertow.channels.DetachableStreamSinkChannel.write(DetachableStreamSinkChannel.java:240)
> at
> org.apache.camel.component.undertow.UndertowProducer$UndertowProducerCallback.completed(UndertowProducer.java:166)
> at
> org.apache.camel.component.undertow.UndertowProducer$UndertowProducerCallback.completed(UndertowProducer.java:121)
> at
> io.undertow.client.http.HttpClientExchange.invokeReadReadyCallback(HttpClientExchange.java:190)
> at
> io.undertow.client.http.HttpClientConnection.initiateRequest(HttpClientConnection.java:293)
> at
> io.undertow.client.http.HttpClientConnection.sendRequest(HttpClientConnection.java:228)
> at
> org.apache.camel.component.undertow.UndertowProducer.process(UndertowProducer.java:102)
> at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
> ... 10 more
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)