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

MongoConnectionPool - Object reference not set to instance of object

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 1.0
    • None
    • None
    • None
    • Windows 7 x64

    Description

      When closing a connection, getting "Object reference not set to instance of object". It's coming from MongoConnecitonPool.ReleaseConnection(MongoConnection connection):

      connection.LastUsedAt = DateTime.UtcNow;
      availableConnections.Add(connection);
      Monitor.Pulse(connectionPoolLock);

      Looks like this is getting called after the close method, which sets the availableConnections to null. I assume at this point that the connection is just being abandoned, and has already been close, I added an if statement to my code to make sure availableConnections wasn't null before adding it back to the pool. Not sure if that's the right answer.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: