Make poll return errno::inval if there are no subscriptions.#193
Merged
sunfishcode merged 1 commit intoWebAssembly:masterfrom Jan 16, 2020
Merged
Make poll return errno::inval if there are no subscriptions.#193sunfishcode merged 1 commit intoWebAssembly:masterfrom
sunfishcode merged 1 commit intoWebAssembly:masterfrom
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.
9 tasks
Contributor
|
I think that
But it's not supported by WASI. |
Member
Author
|
That's a good point. From a pure WASI perspective, this issue feels more like an |
peterhuene
approved these changes
Jan 16, 2020
Member
Author
|
We discussed this in the video call today, and there were no objections, so I'm calling it a consensus. |
sunfishcode
added a commit
to WebAssembly/wasi-libc
that referenced
this pull request
Jan 16, 2020
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.
sunfishcode
added a commit
to WebAssembly/wasi-libc
that referenced
this pull request
Jan 17, 2020
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.
marmistrz
added a commit
to marmistrz/wasmtime
that referenced
this pull request
Jan 17, 2020
marmistrz
added a commit
to marmistrz/wasmtime
that referenced
this pull request
Jan 17, 2020
marmistrz
added a commit
to marmistrz/wasmtime
that referenced
this pull request
Jan 17, 2020
sunfishcode
pushed a commit
to bytecodealliance/wasmtime
that referenced
this pull request
Jan 17, 2020
* Return EINVAL in poll_oneoff with no events. We adhere to WebAssembly/WASI#193. * Add a test for empty poll.
sunfishcode
added a commit
to WebAssembly/wasi-libc
that referenced
this pull request
Feb 24, 2020
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.
sunfishcode
added a commit
to WebAssembly/wasi-libc
that referenced
this pull request
Mar 3, 2020
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.
sunfishcode
added a commit
to WebAssembly/wasi-libc
that referenced
this pull request
Mar 18, 2020
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.
sunfishcode
added a commit
to WebAssembly/wasi-libc
that referenced
this pull request
Jun 2, 2020
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.
sunfishcode
added a commit
to WebAssembly/wasi-libc
that referenced
this pull request
Jun 2, 2020
* 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.
yoshuawuyts
pushed a commit
to yoshuawuyts/WASI
that referenced
this pull request
Nov 25, 2025
…mbly#193) `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.
yoshuawuyts
pushed a commit
to yoshuawuyts/WASI
that referenced
this pull request
Nov 25, 2025
…mbly#193) `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.
yoshuawuyts
added a commit
to yoshuawuyts/WASI
that referenced
this pull request
Nov 25, 2025
…-wit-0.3.0-rc-2025-09-16 Revert "Update 0.3.0 WIT definitions to 0.3.0-rc-2025-09-16"
yoshuawuyts
pushed a commit
to yoshuawuyts/WASI
that referenced
this pull request
Nov 25, 2025
…mbly#193) `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.
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.
pollwith no subscriptions is effectively an infinite hang. Since wasmhas no signals, use cases which involve waking up a libc
pausecall, whichis implemented in terms of a poll with no subscriptions, aren't applicable.
So all
pausecan 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.