You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pruning timer not disposed even after disposing all SqlConnection instances #1881
If you desire to dispose a connection, you should disable connection pooling or there also a method SqlConnection.ClearAllPools for cleaning all the connections.
When invoking SqlConnection.ClearAllPools(), it invokes Shutdown from the pool group which calls Dispose for the timer and should be logging <prov.DbConnectionPool.Shutdown|RES|INFO|CPOOL> in the process.
Not this message => <prov.DbConnectionPool.Shutdown|RES|INFO|CPOOL>.
I mean this message => <prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL>
It's being logged every 30 seconds forever, whether I call ClearAllPools or not.
Here's an excerpt of the log:
(note the 4 minutes gap before this happens)
Activity
lcheunglci commentedon Jan 10, 2023
Hi @a510, thanks for bringing this to our attention and providing the repro steps. We'll take a look soon.
lcheunglci commentedon Jan 10, 2023
If you desire to dispose a connection, you should disable connection pooling or there also a method
SqlConnection.ClearAllPoolsfor cleaning all the connections.a510 commentedon Jan 11, 2023
Thanks @lcheunglci, but even with this code the timer is still running.
lcheunglci commentedon Jan 11, 2023
When invoking
SqlConnection.ClearAllPools(), it invokesShutdownfrom the pool group which calls Dispose for the timer and should be logging<prov.DbConnectionPool.Shutdown|RES|INFO|CPOOL>in the process.a510 commentedon Jan 11, 2023
Not this message =>
<prov.DbConnectionPool.Shutdown|RES|INFO|CPOOL>.I mean this message =>
<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL>It's being logged every 30 seconds forever, whether I call
ClearAllPoolsor not.Here's an excerpt of the log:
(note the 4 minutes gap before this happens)
lcheunglci commentedon Jan 11, 2023
Thanks for the logs, I'll re-open the issue and investigate this further after our release
JRahnama commentedon Jan 18, 2023
@a510 what is the connection time out in the connection string?
a510 commentedon Jan 18, 2023
This is the connection string:
3 remaining items
cheenamalhotra commentedon Jan 8, 2026
@mdaigle will this be addressed with #3356 ?
Fix dotnet#1881 | Make the connection factory pruning timer demand-dr…
Bump Microsoft.Data.SqlClient from 6.1.6 to 7.1.0 (#66)
Bump the microsoft group with 11 updates (#1370)
Bump the nuget-ecosystem group with 6 updates (#16)
Bump the nuget-ecosystem group with 9 updates (#76)