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

E11000 duplicate key error with concurrent inserts from multiple app domains

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.9.2
    • Affects Version/s: 1.9.1
    • Component/s: BSON
    • None

      Same BSON ObjectId is sometimes generated for two different documents when inserts are performed concurrently from different .NET app domains in the same process.

      WriteConcern detected an error 'insertDocument :: caused by :: 11000 E11000 duplicate key error index: <colletionname>.$id dup key: { : ObjectId('538c82074141bd10741de97d') }'.

      My thoughts:
      The ObjectId class appears to not take application domains into account. Using pid, machine name, timestamp, & counter (local to each app domain) is apparently not enough to guarantee uniqueness. Perhaps, app domains should be part of the input.

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

              Created:
              Updated:
              Resolved: