Skip to content

fix(runtime): native poll(2) for guest stdio + event-driven kernel waits#192

Merged
NathanFlurry merged 1 commit into
mainfrom
fix/vim-native-input-and-idle
Jul 2, 2026
Merged

fix(runtime): native poll(2) for guest stdio + event-driven kernel waits#192
NathanFlurry merged 1 commit into
mainfrom
fix/vim-native-input-and-idle

Conversation

@NathanFlurry

@NathanFlurry NathanFlurry commented Jul 2, 2026

Copy link
Copy Markdown
Member
  • The wasm runner's net_poll (the patched libc's poll(2) backend) now reports readiness for every fd type — kernel-managed stdio/PTY fds via __kernel_poll, pipes, regular files, and POLLNVAL for closed fds — instead of host_net sockets only, and sleeps between iterations instead of hot-spinning. select()-based guests (vim) now see stdin readiness and no longer burn CPU while idle.
  • The sidecar services __kernel_stdin_read / __kernel_poll without blocking the dispatch loop: a zero-timeout readiness probe answers immediately when possible, otherwise the RPC is parked (reply-by-token) and an off-loop waiter on the kernel's poll notifier re-enqueues it when poll state changes. Child processes park on the child-event pump with per-iteration rechecks.
  • Runner input waits switched from 10ms polling slices to long event-driven waits (host_tty.read, readKernelStdinChunk, poll_oneoff, net_poll), so idle full-screen guests accrue ~zero active CPU.
  • The wasm "fuel" wall-clock timeout is now opt-in (explicit max_fuel only). Runaway modules stay bounded by the default 30s active-CPU V8 watchdog, while idle interactive guests are no longer killed on wall time.
  • The kernel exposes a cloneable PollWaitHandle for waiting on poll-state changes off the kernel owner's thread.
  • Kill/teardown flushes a parked kernel-wait RPC (EINTR) first, since isolate termination cannot interrupt the native bridge wait — prevents teardown deadlocking against a blocked guest thread.

@railway-app railway-app Bot temporarily deployed to secure-exec / secure-exec-pr-192 July 2, 2026 07:01 Destroyed
@NathanFlurry NathanFlurry merged commit c028e09 into main Jul 2, 2026
1 of 3 checks passed
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