-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make poll return errno::inval if there are no subscriptions. #193
Conversation
`poll` with no subscriptions is effectively an infinite hang. Since wasm has no signals, use cases which involve waking up a libc `pause` call, which is implemented in terms of a poll with no subscriptions, aren't applicable. So all `pause` can do is suspend the program until the host environment terminates it. One situation where that's useful is in debugging, as it's sometimes useful to be able to suspend a process in place so that it can be inspected by a debugger. However, that doesn't require a fully infinite suspend; a suspend with a long timeout is adequate. Making the no-subscriptions case an error can help catch cases where applications unintentionally enter infinite loops.
I think that
But it's not supported by WASI. |
That's a good point. From a pure WASI perspective, this issue feels more like an |
We discussed this in the video call today, and there were no objections, so I'm calling it a consensus. |
With WebAssembly/WASI#193 merged, WASI is moving to make `poll_oneoff` with no arguments an error. Even though that's in ephemeral and not yet in a snapshot, we can start to anticipate it in libc: - Remove the `pause` function, since WASI has no signals and thus no way to ever wake it up short of having the host terminate it. - Make `poll` and `pselect` return `ENOTSUP` in the case of having no events to wait for.
With WebAssembly/WASI#193 merged, WASI is moving to make `poll_oneoff` with no arguments an error. Even though that's in ephemeral and not yet in a snapshot, we can start to anticipate it in libc: - Remove the `pause` function, since WASI has no signals and thus no way to ever wake it up short of having the host terminate it. - Make `poll` and `pselect` return `ENOTSUP` in the case of having no events to wait for.
* Return EINVAL in poll_oneoff with no events. We adhere to WebAssembly/WASI#193. * Add a test for empty poll.
With WebAssembly/WASI#193 merged, WASI is moving to make `poll_oneoff` with no arguments an error. Even though that's in ephemeral and not yet in a snapshot, we can start to anticipate it in libc: - Remove the `pause` function, since WASI has no signals and thus no way to ever wake it up short of having the host terminate it. - Make `poll` and `pselect` return `ENOTSUP` in the case of having no events to wait for.
With WebAssembly/WASI#193 merged, WASI is moving to make `poll_oneoff` with no arguments an error. Even though that's in ephemeral and not yet in a snapshot, we can start to anticipate it in libc: - Remove the `pause` function, since WASI has no signals and thus no way to ever wake it up short of having the host terminate it. - Make `poll` and `pselect` return `ENOTSUP` in the case of having no events to wait for.
With WebAssembly/WASI#193 merged, WASI is moving to make `poll_oneoff` with no arguments an error. Even though that's in ephemeral and not yet in a snapshot, we can start to anticipate it in libc: - Remove the `pause` function, since WASI has no signals and thus no way to ever wake it up short of having the host terminate it. - Make `poll` and `pselect` return `ENOTSUP` in the case of having no events to wait for.
With WebAssembly/WASI#193 merged, WASI is moving to make `poll_oneoff` with no arguments an error. Even though that's in ephemeral and not yet in a snapshot, we can start to anticipate it in libc: - Remove the `pause` function, since WASI has no signals and thus no way to ever wake it up short of having the host terminate it. - Make `poll` and `pselect` return `ENOTSUP` in the case of having no events to wait for.
* Avoid calling `poll_oneoff` with zero subscriptions. With WebAssembly/WASI#193 merged, WASI is moving to make `poll_oneoff` with no arguments an error. Even though that's in ephemeral and not yet in a snapshot, we can start to anticipate it in libc: - Remove the `pause` function, since WASI has no signals and thus no way to ever wake it up short of having the host terminate it. - Make `poll` and `pselect` return `ENOTSUP` in the case of having no events to wait for. * Remove `pause` from the defined-symbols.txt list. * Fix __wasilibc_unmodified_upstream markers. * Check for zero subscriptions, rather than zero events. Make `poll` and `pselect` return `ENOTSUP` when asked to poll on zero subscriptions, rather than when the systerm returns zero events. While here, drop the `__wasilibc_unmodified_upstream` markers, which were already pretty noisy here, and would be significantly worse with this change. * Add comments about the subtle relationship between nfds and nsubscriptions. * Rewrite the comment. * Fix code quotes.
poll
with no subscriptions is effectively an infinite hang. Since wasmhas no signals, use cases which involve waking up a libc
pause
call, whichis implemented in terms of a poll with no subscriptions, aren't applicable.
So all
pause
can do is suspend the program until the host environmentterminates it.
One situation where that's useful is in debugging, as it's sometimes useful
to be able to suspend a process in place so that it can be inspected by a
debugger. However, that doesn't require a fully infinite suspend; a suspend
with a long timeout is adequate.
Making the no-subscriptions case an error can help catch cases where
applications unintentionally enter infinite loops.