Incorrect reference counting and resource leaks

XMLWordPrintableJSON

    • Type: Epic
    • Resolution: Unresolved
    • Priority: Unknown
    • 5.7.0
    • Affects Version/s: None
    • Component/s: Internal
    • Resource leaks
    • Java Drivers
    • Not Needed
    • In Progress
    • None
    • 0
    • 0
    • 0
    • 100
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      This epic groups the tickets related to incorrect reference counting and the resource leaks caused by it.

      Originally, using logging with netty would cause a IllegalReferenceCountException error when trying to read from a ByteBufBsonDocument.
      This is because all byte buffers were released when creating the CompositeByteBuf and the components of the CompositeByteBuf were duplicated
      using ByteBuf#asReadOnly. As the NettyByteBuf#asReadOnly just returned this. Netty would see the resources were freed and then would
      throw a IllegalReferenceCountException when looking up the firstKey for the command name.

      JAVA-5982 impelmented a fix for logging using netty by returning a new NettyByteBuf which would manage its resources.

      Unintended consequences of JAVA-5982 were netty ByteBuf instances would leak due to the lack of resource management in ByteBufBsonDocument.

      Reverting the fix means that using a LoggingCommandEventSender would no longer be possible using Netty and risks a IllegalReferenceCountException.

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

              Created:
              Updated:
              None
              None
              None
              None
              None