Skip to content

Comments

Fix flaky GC-based tests in AsyncLazyTests#1544

Open
AArnott wants to merge 1 commit intomainfrom
dev/andarno/testStabilization
Open

Fix flaky GC-based tests in AsyncLazyTests#1544
AArnott wants to merge 1 commit intomainfrom
dev/andarno/testStabilization

Conversation

@AArnott
Copy link
Member

@AArnott AArnott commented Feb 21, 2026

ValueFactoryReleasedAfterExecution and AsyncPumpReleasedAfterExecution were intermittently failing in CI because GC.Collect() alone does not guarantee collection of objects tied to async state machines. Replace the non-deterministic collection loop with a single Task.Yield() to release async state machine references, followed by forced blocking full GC with GC.WaitForPendingFinalizers() to ensure deterministic cleanup.

ValueFactoryReleasedAfterExecution and AsyncPumpReleasedAfterExecution were intermittently failing in CI because GC.Collect() alone does not guarantee collection of objects tied to async state machines. Replace the non-deterministic collection loop with a single Task.Yield() to release async state machine references, followed by forced blocking full GC with GC.WaitForPendingFinalizers() to ensure deterministic cleanup.
@AArnott AArnott enabled auto-merge February 21, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant