-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.1
-
Component/s: None
-
None
Currently the C# driver closes all connections in the connection pool whenever an error occurs on any connection. This makes sense in a few cases (for example, the server went away), but in many cases it just makes things worse by causing a Connect/Disconnect storm where connections don't live for very long.
Furthermore, since Disconnect closes sockets as a background task, it is possible under heavy load to open connections faster than they are being closed, which can overwhelm the server.
This condition is triggered automatically by high exception rates under load, or can also be triggered by the user code itself by calling Disconnect frequently (some developers have erroneously assumed it is necessary to call Connect and Disconnect around every database operation).
The easiest way to tell if this is happening to you is to examine the server logs for frequent "end connection" log entries.
The driver should be very conservative about ever closing all the connections in the connection pool. It should only do so when it can be 100% certain that all connections are doomed and are going to fail anyway (at the moment I'm not sure how we could be 100% sure, so we might just stop doing this).