Repository navigation
Unsubscribe PriorityChanged in WebServiceGroup.Clear() - #56
Open
ImanEstiri wants to merge 1 commit into
Open
ImanEstiri wants to merge 1 commit into
ImanEstiri wants to merge 1 commit into
Conversation
Clear() emptied the internal list but left every service's PriorityChanged handler attached, unlike Remove() and WebServiceCollection.Clear(). A service removed this way was kept alive by the group's handler (a leak), and re-prioritising itself put it back into the list via Services.ChangePriority(). Fixes Garados007#45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #45
What this changes
WebServiceGroup.Clear()now unsubscribes every contained service fromPriorityChangedbefore clearing the internal list, matching whatRemove()andWebServiceCollection.Clear()already do.Why
Without the unsubscribe, a cleared service kept a live handler reference
to the group (a memory leak), and changing its own
Priorityre-added itto the group via
Services.ChangePriority()— so a "cleared" group couldsilently regain services it no longer owned.
Testing
dotnet build -c Releasepasses on bothnet8.0andnet10.0dotnet test --filter "FullyQualifiedName~TestWebServiceGroup"passesTestWebServiceGroupwith two regression tests:TestClearDetachesFromPriorityChanged— fails without the fix, passes with itTestRemoveDetachesFromPriorityChanged— pins the pre-existing behaviour ofRemove()so the two paths cannot drift apart laterNote on unrelated test failure
Running the full
dotnet testlocally showsTestSecureWebServerDropsAStalledConnectionThatNeverSendsAnything(both target frameworks) failing after its 5-second wait. This is an SSL
handshake-timeout test, unrelated to this change, and it reproduces on a clean
maincheckout without my changes applied. I left it untouched in this PR.