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

Fix data-race in the resharding commit monitor unit-tests

    • Fully Compatible
    • ALL
    • v5.0
    • Sharding 2021-06-14
    • 33
    • 1

      The UnblocksWhenCancellationTokenIsCancelled test (defined here) may hang due to the following:

      • The main-thread proceeds with running commands for the mocked network interface (here), but is scheduled out after running the first command, which cancels the cancelation token.
      • The commit monitor is notified about the cancelation, by checking the cancelation token in here, and returns from the function that queries the shards. As a result, the instance of ARS goes out of scope, and the destructor for ARS cancels any pending network operations.
      • The main thread is scheduled again to run commands on behalf of the mocked network interface, but since the pending commands are canceled, it will stay blocked forever.

      The simple fix for this data-race is to create a new fail-point that blocks the commit-monitor in here, and unblocks it after canceling the cancelation token. This change obviates the need for the main thread to serve any commands for the mocked network interface.

            amirsaman.memaripour@mongodb.com Amirsaman Memaripour
            amirsaman.memaripour@mongodb.com Amirsaman Memaripour
            0 Vote for this issue
            2 Start watching this issue