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

Prevent data race in `NetworkInterfaceMock::NetworkOperation`

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • ALL
    • Service Arch 2022-10-17
    • 15

      NetworkInterfaceMock can receive multiple responses for a particular request, though only the first to be processed is used while any others are disregarded. This is handled by checking whether a NetworkOperation has been marked as finished, and doing so if not. Response processing can only be done by a thread simulating the network.

      It is possible for another thread to issue a cancellation response for a particular request and cause a data race when checking whether the operation the response is for has already finished, while the network thread is processing the first response received for the same request.

      Since any responses processed for a request besides the first are disregarded, the problematic read that checks if an operation has finished in order to determine whether or not to send a cancellation response is superfluous, and should be removed.

            Assignee:
            reo.kimura@mongodb.com Reo Kimura (Inactive)
            Reporter:
            reo.kimura@mongodb.com Reo Kimura (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: