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
    • 🟢 On Track
    • Hide

      Engineer: Ross Lawley

      2026-02-26:

      • Last two weeks:
        • Initial ByteBufBsonDocument changes through review
        • Other code in code review
      • What's the focus over the next two weeks?
        • Code review, updates from main and merge
      • Any risks/blockers/impediments?
        • Slav Babanin released a smaller fix in 5.6.4 to fix the initial blocker for Apple.
      Show
      Engineer: Ross Lawley 2026-02-26: Last two weeks: Initial ByteBufBsonDocument changes through review Other code in code review What's the focus over the next two weeks? Code review, updates from main and merge Any risks/blockers/impediments? Slav Babanin released a smaller fix in 5.6.4 to fix the initial blocker for Apple.
    • Hide

      2026-02-26 - 🟢 On Track
      Engineer: Ross Lawley

      2026-02-26:

      • Last two weeks:
        • Initial ByteBufBsonDocument changes through review
        • Other code in code review
      • What's the focus over the next two weeks?
        • Code review, updates from main and merge
      • Any risks/blockers/impediments?
        • Slav Babanin released a smaller fix in 5.6.4 to fix the initial blocker for Apple.

      2026-02-17 - 🟢 On Track
      Engineer: Ross Lawley

      2026-02-17:

      • Last two weeks:
        • All code in review
      • What's the focus over the next two weeks?
        • Code review and merge
      • Any risks/blockers/impediments?
        • May have to release an alpha / rc version for Apple.

      2026-02-05: - 🟢 On Track

      • What was accomplished since the last update?
        • Refactoring done and needed to be split for manageable review
      • What's the focus over the next two weeks?
        • Code review and merge
      • Any risks/blockers/impediments?
      Show
      2026-02-26 - 🟢 On Track Engineer: Ross Lawley 2026-02-26: Last two weeks: Initial ByteBufBsonDocument changes through review Other code in code review What's the focus over the next two weeks? Code review, updates from main and merge Any risks/blockers/impediments? Slav Babanin released a smaller fix in 5.6.4 to fix the initial blocker for Apple. 2026-02-17 - 🟢 On Track Engineer: Ross Lawley 2026-02-17: Last two weeks: All code in review What's the focus over the next two weeks? Code review and merge Any risks/blockers/impediments? May have to release an alpha / rc version for Apple. 2026-02-05: - 🟢 On Track What was accomplished since the last update? Refactoring done and needed to be split for manageable review What's the focus over the next two weeks? Code review and merge Any risks/blockers/impediments?
    • 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:
              6 weeks, 4 days
              None
              None