Skip to content

runtime: preserve coalesced events in retained native poll - #297

Merged
cpunion merged 4 commits into
llvm-corofrom
coro/native-poll-duplicate-20261018
Oct 18, 2026
Merged

cpunion merged 4 commits into
llvm-corofrom
coro/native-poll-duplicate-20261018

Conversation

@cpunion

@cpunion cpunion commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

A native program can abort while importing retained poll readiness if another producer has already published readiness or closing for the same operation. The unchanged old net/http/httptest image reproduces SIGABRT; failure-only debugger captures show PollOperationPostDuplicate(2) rejected by the native wait adapter before the strict entry validator reports Invalid.

Accept the existing coalesced result and return to the reducer, preserving the first mailbox result. Invalid, stale and retired operations remain rejected. The native entry validator, protocol and G/P/ABI layouts are unchanged.

Validation:

  • A deterministic regression uses real POSIX poll revents and exact operation IDs, forces Ready-first and Closing-first publication, and checks one delivery, preserved Closing, and recycling. Restoring only the old comparison fails both orderings; the fix passes ten shuffled race-enabled runs and rejection controls.
  • The rebuilt frozen fixed httptest image passes 2000/2000 consecutive P=2 executions with an unchanged hash. The original old-image failure is retained.
  • Frozen production 828bfe0 passes compiler/SSA/protocol/FFI, 73 source/fleet checks (26 linked native fleet cases), runtime core/doorbell race tests, 2462 FD/Open executions, 315 reflected positives and 18 intentional negatives, and 9 independent archive tests (20 images, 60 executions). Full test/go passes 276/276 with no failures or skips; all 45 nested compiler process domains joined.

Host follow-up 1613848 updates two source-layout assertions after extraction of the import helper. CI follow-up 1020ee0 runs all four archive consumers in fresh processes under the unchanged 6 GiB virtual cap, 2 GiB Go soft target and 12m/11m limits. All four pass; the original cumulative BoundLarge OOM and failed images remain retained.

CI 39105987770 at 1020ee0 finishes 19 jobs passing and one genuine timer-fixture failure. Failure-only captures and a collector mark watch identify libgc's static mmap endpoint hint GC_unix_mmap_get_mem::last_addr conservatively marking a public Timer at an adjacent page start, which then retains its channel. The exact untraced image also reproduces locally on run 4203. Five matched no-write debugger controls fail at the original five-second assertion; clearing only that allocator hint lets five matched runs pass in about 90ms. Diagnostic runs: failure capture, mark source, causal controls.

Test-only follow-up 6fcca26 selects the same 32 Timer/Ticker pairs away from that native page-boundary false root and stops rejected guard pairs. All 128 selected weak-reference checks, the five-second deadline, and full manager retirement assertions remain identical. Added retained-Timer and extra-G negative controls independently exercise both failure assertions. Native Linux validation passes P=1x100 and P=2x1000; both controls produce their exact expected panic at five seconds. This corrects the fixture's collector assumption; conservative GC false roots and lack of a general prompt-weak-collection guarantee remain explicit boundaries. It does not change production GC or timer ownership.

PR merged into cpunion/llgo:llvm-coro as 603c781 after exact-head CI 39111825084 passes 20/20, local native/WASI suites pass all three timer fixtures each (including both native negative controls), and fresh reviews/inline comments/issue comments/review threads are empty. The merged file tree matches the tested head.

The new 1082-case GOROOT campaign, 73 executable demos, 180 stdlib packages and refreshed performance/size measurements remain separate overall-acceptance work. Historical R6 results are not counted as runs of this production fix.

Select all 32 Timer/Ticker pairs away from native page starts, retaining all 128 weak-reference checks and the five-second manager-retirement deadline. Add retained-Timer and extra-G negative controls. The collector mapping-hint false root is a documented collection boundary; production runtime code is unchanged.
@cpunion
cpunion marked this pull request as ready for review October 18, 2026 08:57
@cpunion
cpunion merged commit 603c781 into llvm-coro Oct 18, 2026
20 checks passed
@cpunion
cpunion deleted the coro/native-poll-duplicate-20261018 branch October 24, 2026 02:11
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