Repository navigation
Normalize WASI deadline-event accounting (I02) - #28
Merged
Merged
Conversation
added 2 commits
September 15, 2026 10:41
The WASI backends counted their own deadline wake as native work, so a timer-only wake reported zero zero-event OS waits and DESIGN section 10 rule 4a's no-spin bound could not see it. WASI 0.2 appends its deadline pollable after the owned handles, so its readiness has no owners entry: count only socket and DNS indices. WASI 0.3 joins a deadline subtask to the wait set: recognize an event whose waitable is that subtask, skip the operation scan for it and report the step as empty. Real socket, DNS and notifier events in the same call still count. Shared contract quiet_deadline_accounting proves, for the three design delays, that each of sixty expiries costs exactly one blocking wait that observed no native event, identically idle and with a registered-but-idle read, and that a call carrying real bytes is not counted empty. The quiet-deadline allocation gate now runs on both WASI targets and covers the registered-but-idle phase.
|
Warning Review limit reachedNext included review available in 21 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (11)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Implements remaining-work item I02. Report:
docs/lanes/tl-i02.md.Both WASI backends counted a quiet deadline expiry as native work, so a timer-only wake reported
zero_event_waits == 0and the no-spin gates could not see a spin there. Native backends already normalize this (IOCP explicitly, epoll through its private timerfd).pollappends the private deadline pollable without anownersentry, but passedindices.is_empty(). It now counts native events in the existing dispatch loop (indices resolving to a socket or DNS owner) and passesnative_events == 0. No extra pass, no allocation.emptywaskind == 0, but a quiet expiry returns one event whose waitable is the deadline subtask. That event is now hoisted intodeadline_event, reused for the existing cancellation decision, skipped in the operation scan, andemptybecomeskind == 0 || deadline_event.waits/discovery_pollssplit already expresses.backend/mod.rsrustdoc, DESIGN §10 rule 4a,docs/BACKEND_REVISION_2.mdandCONTRIBUTING.md.Tests
New shared contract
quiet_deadline_accounting, instantiated natively, on both WASI arms and on Windows. Per expiry at 0.5/2/10 ms: exactly one native call,zero_event_waits == 1, one turn, exact deadline; identical totals idle and with a registered-but-idle read; plus a control where that read takes real bytes and the call must not count as zero-event. The existing quiet-deadline allocation gate now runs on both WASI targets too.Mutation-proved both directions: reverting either backend fails with
left: (1, 0) right: (1, 1); over-normalizing (empty = true) fails the real-I/O control.Verification
macOS native (1645 tests), WASI 0.2 and 0.3 runtime on wasmtime 46, strict clippy across native, Linux (both epoll modes), Windows, wasip2, wasip3 and web, stable check, rustdoc, no-tokio and soak. Linux and Windows runtime run in this PR's CI.