Re-enable the ArrayPool PollingEventFires test#131326
Open
tannergooding wants to merge 2 commits into
Open
Conversation
The original failure (dotnet#44037) was a remote-process hang against the old ArrayPool implementation, which has since been rewritten. Harden the poll check against the Gen2GcCallback finalizer timing -- a single gen2 collection isn't guaranteed to run the callback that emits the poll event -- by retrying a bounded number of times. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR re-enables the System.Buffers.ArrayPool polling/trim EventSource test by removing the stale [ActiveIssue] skip and making the test’s “event eventually fires” assertion more resilient to GC/finalizer timing.
Changes:
- Removed
[ActiveIssue("https://github.com/dotnet/runtime/issues/44037")]fromPollingEventFires. - Hardened the second poll check by retrying
GC.Collect(2)+GC.WaitForPendingFinalizers()up to a bounded number of times until theBufferTrimPollevent is observed.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Runtime/tests/System.Buffers.Tests/ArrayPool/CollectionTests.cs | Re-enables PollingEventFires and adds a bounded retry loop to reduce GC/finalizer timing flakiness. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
The listener callback runs on the finalizer thread, so read/write the flag with Volatile to avoid a visibility race with the retry loop. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2 tasks
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.
Fixes #44037.
System.Buffers.ArrayPool.Tests.CollectionTests.PollingEventFireswas disabled in 2020 via[ActiveIssue]. The original failure was a remote-process hang (Half-way through waiting for remote process. Timed out ... after 60000ms, child process idle at0.13sCPU) against the oldArrayPoolimplementation, which has since been fully rewritten (SharedArrayPool<T>). The staleActiveIssuewas never revisited.The
BufferTrimPollevent is emitted fromSharedArrayPool<T>.Trim(), which only runs inside aGen2GcCallbackfinalizer. A singleGC.Collect(2)+GC.WaitForPendingFinalizers()isn't guaranteed to promote-then-collect that freshly-registered callback object and run its finalizer, so the positive assertion could race. Harden the second poll check to retry a bounded number of times until the event fires.Validated locally by running the test 30x under the current implementation with no hangs or failures.
Note
This PR was authored by Copilot (GitHub Copilot CLI) on behalf of @tannergooding.