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

Deadlock possible between BsonDefaultSerializer and BsonClassMap when classes are AutoMapped on the fly

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.1
    • Affects Version/s: 1.0
    • Component/s: None
    • None

      In a heavily multithreaded environment it is possible to get a deadlock between threads when classes are AutoMapped on the fly as needed.

      Sample program to reproduce attached. Must add a 1 second sleep to BsonDefaultSerializer.LookupActualType right after the lock on staticLock is acquired to have high probability of encountering the deadlock (the deadlock can occur without the sleep but with such low probability that it would be harder to reproduce).

        1. Program.cs
          2 kB
          Robert Stam

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

              Created:
              Updated:
              Resolved: