alexcrichton requested jameysharp for a review on PR #6833.
alexcrichton requested wasmtime-core-reviewers for a review on PR #6833.
alexcrichton opened PR #6833 from alexcrichton:use-worker-thread-unix
to bytecodealliance:main
:
Currently stdin on Unix uses
AsyncFd
after setting the nonblocking flag on the stdin file descriptor. This cannot generally be relied on to succeed or work well in cases such as:
On Linux if stdin is a file (e.g.
wasmtime < ./foo.txt
) then that can't be added to epoll andepoll_ctl
fails with EPERM.On macOS if stdin is
/dev/null
that can't be added to kqueue and fails withEINVAL
.Currently this causes Wasmtime to panic due to a
.unwrap()
in failing to register stdin. To fix this this commit removes the Unix-specific logic usingAsyncFd
and instead falls back to unconditionally using a spawned thread like Windows does. This does mean it's a little less lightweight but should be more robust in situations like the above.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested pchickey for a review on PR #6833.
alexcrichton updated PR #6833.
alexcrichton edited PR #6833:
Not all file descriptors can get registered with epoll, for example
files on Linux or/dev/null
on macOS return errors. In these
situations the fallback of the worker thread implementation is used
instead.
Last updated: Nov 22 2024 at 16:03 UTC