Netty variants of test-reactive-task and test-core-task sometimes fail leak detector test

XMLWordPrintableJSON

    • Type: Build Failure
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Test Failure
    • None
    • Java Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      In https://github.com/mongodb/mongo-java-driver/pull/1762 we started failing the build if the Netty leak detector detected any leaks.  Since then, Netty variants of the test-reactive-task and test-core-task often fail, e.g. here. The leak stack trace is typically something like:

      [2025/12/03 18:33:58.890]     23:33:58.850 [cluster-rtt-ClusterId{value='6930c8e66803719710c5d5f2', description='client0'}-localhost:27017] ERROR io.netty.util.ResourceLeakDetector - LEAK: ByteBuf.release() was not called before it's garbage-collected. See https://netty.io/wiki/reference-counted-objects.html for more information.
      [2025/12/03 18:33:58.890]     Recent access records:
      [2025/12/03 18:33:58.890]     Created at:
      [2025/12/03 18:33:58.890]     	io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:403)
      [2025/12/03 18:33:58.890]     	io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:188)
      [2025/12/03 18:33:58.890]     	io.netty.buffer.AbstractByteBufAllocator.buffer(AbstractByteBufAllocator.java:124)
      [2025/12/03 18:33:58.890]     	com.mongodb.internal.connection.netty.NettyStream.getBuffer(NettyStream.java:160)
      [2025/12/03 18:33:58.890]     	com.mongodb.internal.connection.InternalStreamConnection.getBuffer(InternalStreamConnection.java:939)
      [2025/12/03 18:33:58.890]     	com.mongodb.internal.connection.ByteBufferBsonOutput.getByteBufferAtIndex(ByteBufferBsonOutput.java:191)
      [2025/12/03 18:33:58.890]     	com.mongodb.internal.connection.ByteBufferBsonOutput.getCurrentByteBuffer(ByteBufferBsonOutput.java:177)
      [2025/12/03 18:33:58.890]     	com.mongodb.internal.connection.ByteBufferBsonOutput.writeInt32(ByteBufferBsonOutput.java:91)
      [2025/12/03 18:33:58.890]     	com.mongodb.internal.connection.RequestMessage.writeMessagePrologue(RequestMessage.java:105)
      [2025/12/03 18:33:58.890]     	com.mongodb.internal.connection.RequestMessage.encode(RequestMessage.java:94)
      [2025/12/03 18:33:58.890]     	com.mongodb.internal.connection.CommandMessage.encode(CommandMessage.java:74)
      [2025/12/03 18:33:58.890]     	com.mongodb.internal.connection.InternalStreamConnection.sendAndReceiveAsyncInternal(InternalStreamConnection.java:611) 

       

            Assignee:
            Ross Lawley
            Reporter:
            Jeffrey Yemin
            None
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: