Incorrect reference counting and resource leaks

XMLWordPrintableJSON

    • Type: Epic
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Internal
    • Resource leaks
    • Java Drivers
    • None
    • 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?
    • To Do
    • 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:
            Unassigned
            Reporter:
            Valentin Kavalenka
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              None
              None
              None
              None
              None