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

Race condition could result in BinaryConnection Dispose method running twice

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.3
    • 2.2.4
    • Connectivity
    • None

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: