Skip to content

Conversation

@dicej
Copy link
Contributor

@dicej dicej commented Dec 10, 2025

The spec says we should allow this, so now we do.

Thansk to Alex for the test case!

Fixes #12128

The spec says we should allow this, so now we do.

Thansk to Alex for the test case!

Fixes bytecodealliance#12128

Co-authored-by: Alex Crichton <alex@alexcrichton.com>
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
@dicej dicej requested a review from alexcrichton December 10, 2025 22:36
@dicej dicej requested a review from a team as a code owner December 10, 2025 22:36
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code/test all look fine, but I'm trying to correlate this with the spec as well. I thought I remember that historically may_enter was a thing but it's no longer present in CanonicalABI.md. Can you clarify which point in the spec I should be looking at to double-check this? (and probably queue up some sort of rename/refactor to handle may_enter to align with the spec)

@dicej
Copy link
Contributor Author

dicej commented Dec 10, 2025

Code/test all look fine, but I'm trying to correlate this with the spec as well. I thought I remember that historically may_enter was a thing but it's no longer present in CanonicalABI.md. Can you clarify which point in the spec I should be looking at to double-check this? (and probably queue up some sort of rename/refactor to handle may_enter to align with the spec)

Search for trap_if_on_the_stack in CanonicalABI.md and the prose that follows. I agree that some renaming and/or refactoring may be due.

@dicej
Copy link
Contributor Author

dicej commented Dec 10, 2025

I'm investigating the test failure; looks like dropping a subtask while it's yielding in an infinite loop will require some extra care. EDIT: the problem is more fundamental than that, and the refactoring Alex suggested above is going to be necessary in order to fix #12128 properly.

@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Dec 11, 2025
@alexcrichton
Copy link
Member

Joel and I discussed this and the conclusion is that the may_enter handling in Wasmtime is outdated and no longer in sync with the spec after component-model-async refactors. Effectively we need to rebuild the reentrance check from scratch throughout Wasmtime and avoid using may_enter for the triple-purpose of: preventing reentrance, requiring post_return, and lockdown-on-trap. This'll require refactors internally to use a new component-model-async helper but will have an impact on component adapter performance as well. This all corresponds to trap_if_on_the_stack in the spec (scroll down a bit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

component-model-async: Cannot reenter component during a task's yield?

2 participants