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

Make PrimaryOnlyService::shutdown explicitly interrupt tracked OperationContexts

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.9.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • Service arch 2020-12-28, Sharding 2021-02-22
    • 1

      SERVER-51095 made PrimaryOnlyService::stepdown explicitly interrupt tracked OperationContexts, because a PrimaryOnlyService instance could create a new OperationContext in the window between when the stepdown thread kills OperationContexts and calls PrimaryOnlyService::stepdown via updateMemberState.

      On shutdown:

      First ReplicationCoordinator::stepdown is called.

      Then ReplicationCoordinator::shutdown is called, which calls PrimaryOnlyService::shutdown, which joins all running instances.

      Finally, all OperationContexts are marked as killed.

      However, the first step ReplicationCoordinator::stepdown is allowed to fail. In that case, PrimaryOnlyService::shutdown may try to join a running instance whose OperationContext has not been interrupted.

      To avoid this, PrimaryOnlyService::shutdown should also explicitly interrupt all its OperationContexts.

            Assignee:
            blake.oler@mongodb.com Blake Oler
            Reporter:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: