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

Race condition with reusing connections

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • 1.8.3
    • 1.8.1
    • None
    • None
    • OSX, Mono 3.2.1
    • Fully Compatible

    Description

      When executing the code:

      List<TDmo> items = cursor.ToList();

      An error occurs deserializing a document. Code in the finally block of MongoDB.Bson/Serialization/Serializers/BsonClassMapSerializer.cs, DeserializeMemberValue(BsonReader, BsonMemberMap) throws a nice exception.

      Then, while unwinding the stack the finally block in MongoCSharp/MongoDB.Driver/Operations/QueryOperation.cs, Execute(IConnectionProvider) calls KillCursor() which calls AcquireConnection(). This appears to acquire the connection that is in the process of being closed from the exception above.

      If you step through the code in the debugger (MonoDevelop or Xamarin Studio), you slow things down enough so that a FileFormatException is throw. In production, you typically just the InvalidOperationException.

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            john@lyon-smith.org John Lyon-Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: