Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-2875

Race condition in TcpStreamFactory could result in CreateStream returning a NetworkStream with a closed Socket

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.10.1
    • Affects Version/s: 2.10.0
    • Component/s: Connectivity
    • Labels:
      None

      If a timeout or cancellation request happens AFTER `socket.Connect` returns but BEFORE the `connected` variable is set to true the socket could be Closed before the Connect helper method returns:

      https://github.com/mongodb/mongo-csharp-driver/blob/v2.10.0/src/MongoDB.Driver.Core/Core/Connections/TcpStreamFactory.cs#L144

      The window for the race condition is VERY small and therefore low probability.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: