Fix | Fix possible server connection leak if an exception occurs in pooling layer - #890
Conversation
c881b91 to
8fb621f
Compare
|
This change can be tested using the TestTdeServer and injecting transient failures Another example of the usage of server is at |
|
LGTM. |
|
/azp run CI-BuildNPack |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Hi @saurabh500 I've added the test case and I can also reproduce In order to capture the leaked connection, you'll need to add breakpoint in exception handling logic in the test and capture heap snapshot. Navigating through Heap Snashot you will come across 1 instance of |

This PR is additional fix for consequences of error
Internal .NET Framework Data Provider error 6.that is thrown fromDbConnectionPool.CreateObjectmethod when something goes wrong in Pooling layer.Continued investigations over original issue that was fixed by #637 led to figuring out that the catch blocks in this method simply set
newObjtonull, leaking resources and TDS connections on server, that can only be garbage collected on client when server drops them.This causes expensive connection leaks on server, and issue exists in System.Data.SqlClient and Microsoft.Data.SqlClient (<2.0.1).
In Microsoft.Data.SqlClient we fixed this issue with PR #638 and #637, this PR is also a fix that ensures resources are cleaned properly in any similar future events.