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

Race condition could result in BinaryConnection Dispose method running twice

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.3
    • Affects Version/s: 2.2.4
    • Component/s: Connectivity
    • None

      The Dispose method of BinaryConnection has code to prevent it from being executed twice. See:

      https://github.com/mongodb/mongo-csharp-driver/blob/ebc40a80278f79ab86ce19eb6b5656044ee56c65/src/MongoDB.Driver.Core/Core/Connections/BinaryConnection.cs#L172

      But if one thread calls Dispose while another thread is in the middle of opening the connection a race condition exists where the _state of the connection can be changed away from Disposed allowing the body of the Dispose method to subsequently be executed a second time.

            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: