Skip to content
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

refactor poll_until to only ever call wasm inside a fiber #13

Merged
merged 2 commits into from
Feb 18, 2025

Conversation

dicej
Copy link
Collaborator

@dicej dicej commented Feb 14, 2025

With wasmtime's async support enabled, all guest export calls need to happen in a fiber because the guest may call back to the host, which may try to suspend the fiber and return control to the top-level async executor. In fact, even if the guest doesn't call back to the host, epoch interruption might be enabled, in which case the code might be instrumented with yield calls that do the same thing.

In the process of this refactor, I discovered a couple of other issues (e.g. not removing tasks from the "yielding" set when disposing of them) and fixed those as well.

Fixes #9.

@dicej
Copy link
Collaborator Author

dicej commented Feb 14, 2025

Fixes #7

With `wasmtime`'s `async` support enabled, all guest export calls need to happen
in a fiber because the guest may call back to the host, which may try to suspend
the fiber and return control to the top-level async executor.  In fact, even if
the guest doesn't call back to the host, epoch interruption might be enabled, in
which case the code might be instrumented with yield calls that do the same
thing.

In the process of this refactor, I discovered a couple of other issues (e.g. not
removing tasks from the "yielding" set when disposing of them) and fixed those
as well.

Fixes #9.

Signed-off-by: Joel Dice <[email protected]>
@dicej dicej force-pushed the dicej/fibers-galore branch from a9b40bd to 3f9321a Compare February 18, 2025 16:54
We'll address `cargo-vet` auditing when upstreaming these changes, but it's just
a distraction while we're working in this repo.

Signed-off-by: Joel Dice <[email protected]>
@dicej
Copy link
Collaborator Author

dicej commented Feb 18, 2025

Gonna merge this to keep the number of branches down and unblock #15

@dicej dicej merged commit ab30f13 into main Feb 18, 2025
25 checks passed
@dicej dicej deleted the dicej/fibers-galore branch February 18, 2025 19:30
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.

Segfault using Accessor::spawn
1 participant