LEAK: ByteBuf.release() was not called before it's garbage-collected.
See original GitHub issueRedisson 3.5.1
I am debugging why we are seeing ByteBuf leaks and native memory problems. I suspect one reason could be serialization failing for some objects.
I created a simple test to run this code in a loop Object MY_DUMMY_NON_SERIALIZABLE_OBJECT = Logger.getGlobal(); redisson.getMap(“cacheMap”).fastPut(“value”, MY_DUMMY_NON_SERIALIZABLE_OBJECT );
The code triggers: java.lang.IllegalArgumentException: java.io.NotSerializableException: java.util.logging.Logger and looks like MarshallingCodec. Encoder.encode doesn’t clean the ByteBuf if there is an exception - and I don’t see a way to do it myself.
I enabled -Dio.netty.leakDetectionLevel=paranoid to get this output:
SEVERE: LEAK: ByteBuf.release() was not called before it's garbage-collected. See https://netty.io/wiki/reference-counted-objects.html for more information.
Recent access records:
#1:
io.netty.buffer.AdvancedLeakAwareByteBuf.writeBytes(AdvancedLeakAwareByteBuf.java:616)
org.redisson.codec.MarshallingCodec$ByteOutputWrapper.write(MarshallingCodec.java:131)
org.jboss.marshalling.UTFUtils.writeUTFBytes(UTFUtils.java:131)
org.jboss.marshalling.river.RiverMarshaller.writeKnownObject(RiverMarshaller.java:397)
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:217)
org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
org.redisson.codec.MarshallingCodec$4.encode(MarshallingCodec.java:170)
org.redisson.command.CommandAsyncService.encodeMapKey(CommandAsyncService.java:725)
org.redisson.RedissonObject.encodeMapKey(RedissonObject.java:301)
org.redisson.RedissonMap.fastPutOperationAsync(RedissonMap.java:1375)
org.redisson.RedissonMap.fastPutAsync(RedissonMap.java:1365)
org.redisson.RedissonMap.fastPut(RedissonMap.java:1380)
adhoc.testing.RedissonMemoryTest.main(RedissonMemoryTest.java:53)
#2:
io.netty.buffer.AdvancedLeakAwareByteBuf.writeBytes(AdvancedLeakAwareByteBuf.java:616)
org.redisson.codec.MarshallingCodec$ByteOutputWrapper.write(MarshallingCodec.java:131)
org.jboss.marshalling.SimpleDataOutput.shallowFlush(SimpleDataOutput.java:353)
org.jboss.marshalling.river.RiverMarshaller.writeKnownObject(RiverMarshaller.java:396)
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:217)
org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
org.redisson.codec.MarshallingCodec$4.encode(MarshallingCodec.java:170)
org.redisson.command.CommandAsyncService.encodeMapKey(CommandAsyncService.java:725)
org.redisson.RedissonObject.encodeMapKey(RedissonObject.java:301)
org.redisson.RedissonMap.fastPutOperationAsync(RedissonMap.java:1375)
org.redisson.RedissonMap.fastPutAsync(RedissonMap.java:1365)
org.redisson.RedissonMap.fastPut(RedissonMap.java:1380)
adhoc.testing.RedissonMemoryTest.main(RedissonMemoryTest.java:53)
Created at:
io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:385)
io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:187)
io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:173)
io.netty.buffer.AbstractByteBufAllocator.buffer(AbstractByteBufAllocator.java:107)
org.redisson.codec.MarshallingCodec$4.encode(MarshallingCodec.java:165)
org.redisson.command.CommandAsyncService.encodeMapKey(CommandAsyncService.java:725)
org.redisson.RedissonObject.encodeMapKey(RedissonObject.java:301)
org.redisson.RedissonMap.fastPutOperationAsync(RedissonMap.java:1375)
org.redisson.RedissonMap.fastPutAsync(RedissonMap.java:1365)
org.redisson.RedissonMap.fastPut(RedissonMap.java:1380)
adhoc.testing.RedissonMemoryTest.main(RedissonMemoryTest.java:53)
If I can’t get the native memory issues sorted out, I need to see if this can help: -Dio.netty.noPreferDirect=true -Dio.netty.allocator.type=unpooled
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (5 by maintainers)
I hava the problem also.
@anabright
That fix already included in 3.15.3