-
Notifications
You must be signed in to change notification settings - Fork 317
Description
Describe the bug
Since upgrading from SqlClient v6.0.2 to v6.1.1, we noticed in our metrics that the number-of-active-connections
started to report negative values, sometimes quite large -- e.g. -357
Rolling back to v6.0.2 removed the issue.
I am not aware of anyone noticing any other problems with the 6.1.1 upgrade at this stage.
To reproduce
I am not sure what exactly in our codebase is triggering the buggy code path; Our application is quite large and complex, it opens many SQL connections rapidly.
However, I checked out SqlClient locally, built it as part of our application's solution, and used git bisect
to narrow down the commit which introduces the problem.
0322d44c7cfec424cbe33c9f48430f6ad79a8a50 is the first bad commit
commit 0322d44c7cfec424cbe33c9f48430f6ad79a8a50
Author: Malcolm Daigle <[email protected]>
Date: Wed Jan 15 10:38:24 2025 -0800
When testing this, I found the debug assertion in DeactivateConnection would fire shortly after launching the application.
Expected behavior
Metrics should not go negative, debug assertions should not fire.
Further technical details
Microsoft.Data.SqlClient version: (found on the nuget or Microsoft.Data.SqlClient.dll)
.NET target: (e.g. .NET Framework 4.7.2, .NET 6.0)
SQL Server version: (e.g. SQL Server 2022)
Operating system: (e.g. Windows Server 2022, Ubuntu 24.04, macOS 14.7.1, Docker container)
Additional context
Our hosting platform runs Linux, and my local machine is a Mac with an M4 Max. I use JetBrains Rider to build and debug with .NET 8.0.413