[CSHARP-103] when using RequestStart(), ReleaseConnection tries to return in-use connection back to the pool Created: 19/Nov/10  Updated: 02/Apr/15  Resolved: 19/Nov/10

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 0.9
Fix Version/s: 0.9

Type: Bug Priority: Major - P3
Reporter: Testo Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

when using RequestStart(), ReleaseConnection tries to return in-use connection back to the pool resulting in NullReferenceException as Connection has been closed as the pool reaches maximum size. To reproduce, do something like

var db = server.GetDatabase("test");
var collection = db.GetCollection("test");
collection.RemoveAll();
using (var x = db.RequestStart())
{
for( int i=0; i<1000; i++ )
{
collection.Insert(new BsonDocument {

{"blah",i}

}, SafeMode.True);
}
}



 Comments   
Comment by Robert Stam [ 19/Nov/10 ]

p.s. The instructions to reproduce the issue were excellent!

Comment by Robert Stam [ 19/Nov/10 ]

ReleaseConnection in MongoDatabase was calling ReleaseConnection in MongoConnectionPool when it should have been calling ReleaseConnection in MongoServer.

Generated at Wed Feb 07 21:35:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.