Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-79779

AsyncResultsMerger leaks shard cursor when getMore fails due to not primary error

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.0-rc0, 7.0.3
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • ALL
    • v7.1, v7.0
    • QE 2023-08-21, QE 2023-09-04, QE 2023-09-18, QE 2023-10-02
    • 119

      After mongos has established a cursor within a multi-document transaction, if a shard steps down then subsequent requests will fail with NotWritablePrimary error (or they can also fail later due to InterruptedDueToReplStateChange). In this case, AsyncResultsMerger will not attempt to clean up the shard cursors, because NotWritablePrimary/InterruptedDueToReplStateChange are not part of this list or errors. This will cause the shard cursor to be leaked.

      NotWritablePrimary and InterruptedDueToReplStateChange (or the NotPrimaryError category?) should be made part of that list.

      Edit: 'LockTimeout' errors can also occur, and AsyncResultsMerger will also not attempt to clean up cursors in this case.

            Assignee:
            foteini.alvanaki@mongodb.com Foteini Alvanaki
            Reporter:
            jordi.serra-torrens@mongodb.com Jordi Serra Torrens
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: