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

Prevent race condition in Migration Destination Manager from swallowing an exception

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.4.14, 3.6.4, 3.7.3
    • Fix Version/s: 3.4.15, 3.6.5, 3.7.6, 4.0.0-rc0
    • Component/s: Sharding
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.6, v3.4
    • Sprint:
      Sharding 2018-04-23
    • Linked BF Score:
      54

      Description

      A triggerable race condition exists in the Migration Destination Manager's use of the producer-consumer queue. Upon throwing from inside the insert batch function, both of these will happen:

      1. The inserter thread will kill the operation with the insert batch function's exception.
      2. The guard on the inserter thread will close the consumer end of the queue.

      If the main thread is currently fetching another batch from remote, it will try to push the batch to the queue before checking for an operation context interrupt. The queue will throw back its own exception, `ProducerConsumerQueueEndClosed`. The queue's exception will be the exception returned to the client. This results in the wrong error code returned.

      This can be fixed by adding another checkForInterrupt in between the fetch batch function and the push to the queue, in case this race condition is triggered.

        Attachments

          Activity

            People

            Assignee:
            blake.oler Blake Oler
            Reporter:
            blake.oler Blake Oler
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: