runtime: handle ENOTSUP/ENOSYS from poll_oneoff in netpoll_wasip1#78522
runtime: handle ENOTSUP/ENOSYS from poll_oneoff in netpoll_wasip1#78522ssam18 wants to merge 1 commit intogolang:masterfrom
Conversation
Some WASM host runtimes (e.g. Envoy proxy-WASM) export poll_oneoff but return ENOTSUP or ENOSYS because they are event-driven and cannot allow WASM to block. Previously any non-EINTR error from poll_oneoff caused a fatal crash, which surfaced during GC cycles in plugins that import fmt or os. Return zero ready events for these two errnos so the scheduler continues normally, matching the existing behaviour of netpoll_fake.go used by the js/wasm target. Fixes golang#78513
|
This PR (HEAD: 16fe6e4) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/762600. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/762600. |
|
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/762600. |
Some WASM host runtimes export poll_oneoff but return ENOTSUP or ENOSYS rather than implementing it, because they're event-driven and blocking the WASM thread would deadlock their worker. This caused a fatal crash during GC cycles in any wasip1 plugin that transitively imports fmt or os — which is nearly everything.
The fix treats ENOTSUP (58) and ENOSYS (52) the same way as returning zero events, which is always safe when there are no real FD subscriptions and harmless otherwise since the scheduler will re-poll on the next GC cycle. This mirrors what netpoll_fake.go already does for the js/wasm target.
Fix for the issue #78513