ASF GitHub Bot logged work on ARTEMIS-2482:

                Author: ASF GitHub Bot
            Created on: 11/Sep/19 08:42
            Start Date: 11/Sep/19 08:42
    Worklog Time Spent: 10m 
      Work Description: wy96f commented on issue #2832: ARTEMIS-2482 Large 
messages could leak native ByteBuffers
URL: https://github.com/apache/activemq-artemis/pull/2832#issuecomment-530283213
   > @wy96f
   > > PooledByteBufAllocator::directBuffer uses java's ThreadLocal. Wouldn't 
this result in leak in the case if thread terminates due to idle timeout as in 
#2199 ?
   > Do you mean the thread local arena? Or the thread local NIO ByteBuffer?
   > Anyway, at the end of its usage we always release the `ByteBuf` and Netty 
will take care to release any referenced resources: it's a pool so it leaks "by 
   I mean tinySubPageDirectCaches/smallSubPageDirectCaches/normalDirectCaches 
in PoolThreadCache. PoolChunk would be added into these caches first if 
released(not yet into shared arena). Given PoolThreadCache is thread local, 
would theses caches leak if thread terminates?
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

Issue Time Tracking

    Worklog Id:     (was: 310410)
    Time Spent: 2h 50m  (was: 2h 40m)

> Large messages could leak native ByteBuffers
> --------------------------------------------
>                 Key: ARTEMIS-2482
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2482
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: AMQP, Broker, OpenWire
>    Affects Versions: 2.10.0
>            Reporter: Francesco Nigro
>            Priority: Major
>          Time Spent: 2h 50m
>  Remaining Estimate: 0h
> JournalStorageManager::addBytesToLargeMessage and 
> LargeServerMessageImpl::DecodingContext::encode are relying on the pooling of 
> direct ByteBuffers performed internally by NIO.
> Those buffers are pooled until certain size limit (ie 
> jdk.nio.maxCachedBufferSize, as shown on 
> https://bugs.openjdk.java.net/browse/JDK-8147468) otherwise are freed right 
> after the write succeed.
> If the property jdk.nio.maxCachedBufferSize isn't set, the direct buffers are 
> always pooled regardless of the size, leading to OOM issues on high load of 
> variable sized writes due to the amount of direct memory allocated and not 
> released/late released.
> This should be an alternative fix for 
> https://issues.apache.org/jira/browse/ARTEMIS-1811 and it check if such 
> pooling is happening, making large messages to be read/written in chunks by 
> using the Netty ByteBuf pool to handle any intermediate buffer.

This message was sent by Atlassian Jira

Reply via email to