Repository navigation
test: fix flaky owner-collection check in ExternalObjectOwnershipTests - #7794
Conversation
The concurrent ownership test checked the owner's weak reference after a single GC. A worker thread that just completed can still hold the owner in a frame it is unwinding, so under load the check failed about once in 60 runs. A heap dump of a failure showed the owner with no GC roots. Retry the collection for up to a second; a real leak still fails.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Review: LGTM. The retry loop in Two small optional notes:
Nothing blocking. |
[Low impact] The PR appears safe to merge; no actionable issues were found. SummaryThe PR reduces flaky owner-collection checks without changing application code.
Reviews (2) · Last reviewed commit: "test: retry owner collection in External..." · Reviewed by Greptile |
Concurrent_Capture_Registration_And_Counter_Release_Preserve_Owner_Lifetimeflakes under load: "The owner is retained by the ownership registry".Repro: 16 copies of
TUnit.UnitTestsrunningExternalObjectOwnershipTestsat once fails about once in 60 runs. One run alone never fails.On failure the owner had no counted pins and nothing was tracked. A full dump taken at that point showed both
ScopeOwnerinstances with 0 GC roots. So the owner was only reachable for a moment, most likely from a worker thread still unwinding a Debug-build async frame. It wasn't leaked.Fix:
CollectOwnerretries the GC for up to ~1s before failing. A real leak still fails; I checked by pinning the owner in a static field.Results: 0 failures in 800 stressed runs (it was about 1 in 60 before).
TUnit.UnitTestspasses on net10 and net11.Summary by CodeRabbit