-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Based on code inspection.
HttpConnectionPool.HandleAltSvc may create a Timer if Dispose runs during/before it, and it will never be disposed.
The method should check _disposed in this branch (while holding the lock), before creating a new Timer:
runtime/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs
Lines 1155 to 1156 in a1bc0f3
| if (_authorityExpireTimer == null) | |
| { |
The good news is that the timer won't root the HttpConnectionPool instance, but the timer entry may remain queued for a month.
A related issue is that the same method will also access the _authorityExpireTimer outside a lock a few lines above, which could lead to an unexpected ObjectDisposedException leaking out:
runtime/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs
Line 1112 in a1bc0f3
| _authorityExpireTimer.Change(Timeout.Infinite, Timeout.Infinite); |