[CSHARP-323] Timeout in background state management thread crashes application domain Created: 14/Sep/11  Updated: 02/Apr/15  Resolved: 14/Sep/11

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

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

Issue Links:
Related
related to CSHARP-406 Deadlock and TimeoutException when ac... Closed

 Description   

Driver git version 5778f994d4. Exception is not handled in timer callback, so as with any thread pool threads exceptions the application domain goes down when server stops responding and first timeout is encountered.

Exception: System.TimeoutException: Timeout waiting for a MongoConnection.
at MongoDB.Driver.Internal.MongoConnectionPool.AcquireConnection(MongoDatabase database) in Driver\Internal\MongoConnectionPool.cs:line 141
at MongoDB.Driver.MongoServerInstance.VerifyState() in Driver\Core\MongoServerInstance.cs:line 233
at MongoDB.Driver.Internal.MongoConnectionPool.TimerCallback(Object state) in Driver\Internal\MongoConnectionPool.cs:line 268
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading._TimerCallback.PerformTimerCallback(Object state)



 Comments   
Comment by Aristarkh Zagorodnikov [ 14/Sep/11 ]

No problem, glad to help =)

Comment by Robert Stam [ 14/Sep/11 ]

Aristarkh, thanks so much for reporting this. It hadn't shown up in our testing.

Comment by Robert Stam [ 14/Sep/11 ]

Don't let unhandled exceptions leave TimerCallback. The same also applies to EnsureMinConnectionPoolSizeWorkItem.

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