Skip to content

Fix call hooks with yields and concurrent execution#13871

Open
alexcrichton wants to merge 1 commit into
bytecodealliance:mainfrom
alexcrichton:more-hooks
Open

Fix call hooks with yields and concurrent execution#13871
alexcrichton wants to merge 1 commit into
bytecodealliance:mainfrom
alexcrichton:more-hooks

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

This commit fixes two (known) issues with call hooks. The first is a long-standing issue where when Wasmtime yielded due to fuel or epochs the call hooks were not invoked. If hosts were using call hooks to track time executed in a guest, for example, then that would lead to inaccuracies. The second is with component-model-async fiber switches weren't correctly accounted for in terms of the call hook machinery which could lead results to get mixed up.

The fix for both here is the same which is to sink the invocation of call hooks far down into the stack such that they cannot be forgotten when the guest exits to the host. This moves manual invocations, for example, on host functions to instead one central location that handles both host functions and libcalls.

Closes #13870

This commit fixes two (known) issues with call hooks. The first is a
long-standing issue where when Wasmtime yielded due to fuel or epochs
the call hooks were not invoked. If hosts were using call hooks to track
time executed in a guest, for example, then that would lead to
inaccuracies. The second is with component-model-async fiber switches
weren't correctly accounted for in terms of the call hook machinery
which could lead results to get mixed up.

The fix for both here is the same which is to sink the invocation of
call hooks far down into the stack such that they cannot be forgotten
when the guest exits to the host. This moves manual invocations, for
example, on host functions to instead one central location that handles
both host functions and libcalls.

Closes bytecodealliance#13870
@alexcrichton alexcrichton requested a review from a team as a code owner July 13, 2026 16:10
@alexcrichton alexcrichton requested review from dicej and removed request for a team July 13, 2026 16:10
@github-actions github-actions Bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Jul 13, 2026
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.

Apparent missing CallHook transition(s) in run_concurrent

1 participant