Repository navigation
fix: match interrupted connections by the connection, not a reusable id - #1214
Merged
Merged
Conversation
Deadline cancellation marked a connection by `id(connection)` in a process-wide set that only a recovering pool's health check cleared. A mark left on a connection that never returned to such a pool outlived it, and a later connection allocated at the same address was then health-checked as if interrupted, running an extra probe statement. Each mark now holds a weak reference to its connection, or a strong one when the connection cannot be weakly referenced, and a check reports only when the mark still refers to that same connection.
Main runs at 1,778-1,808 MB on CI runners against a 1,812 MB cap, so unrelated branches fail the guard at random (about +/-15 MB runner noise). 1,760 MiB leaves about 31 MB above the highest CI value seen.
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.
Why
A deadline cancellation marked the interrupted connection by
id(connection)in a process-wide set. Only a recovering connection pool's health check cleared marks, so a connection that never returned to such a pool left its mark behind. Once that connection was collected, a later connection allocated at the same address was health-checked as if it had been interrupted, running an extra probe statement and publishing its statement events. This made the scenario capture pipeline's connection-lifecycle unit test fail intermittently in CI. Separately, the 1000-model build memory guard sat within 0.2-0.5% of its cap on main, so unrelated branches failed it at random.Changes
InterruptedConnectionskeeps a weak reference to each marked connection. Objects that can't be weakly referenced get a strong one. A check reports only when the mark still refers to the same connection, and each check still clears the mark.Verification
make check-cipasses, and the hygiene scan is clean.