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

Balancer may trip invariants due to concurrent usage of opCtx from different threads

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 5.2.0
    • Sharding
    • None
    • Fully Compatible
    • ALL

    Description

      Balancer::_moveChunks can submit several asynchonous moveChunk requests concurrently. Each one of these calls to BalancerCommandsSchedulerImpl::requestMoveChunk will use the same opCtx. BalancerCommandsSchedulerImpl::requestMoveChunk will return a SemiFuture, that stores a copy of the opCtx pointer, and as part of its execution will use that opCtx to call processCommandResponse, which will call setLastOpToSystemLastOpTime which takes locks and thus alters the lock state of that opCtx. Thus several threads can concurently alter the opCtx's state, and this can lead to tripping invariants.

      setLastOpToSystemLastOpTime should not be called from the executor callbacks.

      Attachments

        Issue Links

          Activity

            People

              paolo.polato@mongodb.com Paolo Polato
              jordi.serra-torrens@mongodb.com Jordi Serra Torrens
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: