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

Deadlock using Atlas

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.7.0, 2.8.0, 2.9.0, 2.10.2
    • None
    • Environment:
      Windows 10 1903, .NET Core 2.1, Visual Studio 2019

      I'm not sure if this is a driver issue or a breaking change with Atlas.

      I only see the issue when I connect to an Atlas server, if I connect to a 3.12 replicaset server (on my local network) then the code example works fine.

      I'm using the free version of Atlas in a 3 node replicaset configuration (default?). Nothing else configured.

      var client = new MongoClient(...);
      var database = client.GetDatabase(MongoUrl.Create(connectionString).DatabaseName);

      var userAccounts = }}{{database.GetCollection<BsonDocument("userAccounts")
      {{ .WithWriteConcern(WriteConcern.Acknowledged);}}

      var logging =
      {{ database}}.GetCollection<BsonDocument>("logging").WithWriteConcern(WriteConcern.Unacknowledged);

      userAccounts.InsertOne(new BsonDocument());

      await logging.InsertOneAsync(new BsonDocument());

      {{userAccounts.InsertOne(new BsonDocument()); // <-- deadlock here }}

      If I change the logging collection to be WriteConcern.Acknowledged then the deadlock goes away.

      Async or Sync methods don't make any difference.

       

            Assignee:
            dmitry.lukyanov@mongodb.com Dmitry Lukyanov (Inactive)
            Reporter:
            steve.ward.uk@gmail.com Steven Ward
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: