Repository navigation
fix(jco): JSPI-suspended imports hang when they fail - #2309
Merged
vados-cosmonic merged 2 commits intoOct 24, 2026
Merged
Conversation
chenyan2002
requested review from
andreiltd and
vados-cosmonic
as code owners
October 23, 2026 17:33
vados-cosmonic
approved these changes
Oct 24, 2026
vados-cosmonic
left a comment
Collaborator
There was a problem hiding this comment.
LGTM 🚀
Thanks @chenyan2002 , this looks good to me in general, I'm a little worried about throwing early but I think with the fix for the async function that maybe won't be a problem?
Also I'll have to change the commits a little bit.
vados-cosmonic
force-pushed
the
import-rethrow
branch
from
October 24, 2026 05:07
68ec8dc to
2b37096
Compare
vados-cosmonic
enabled auto-merge
October 24, 2026 05:07
Co-authored-by: Yan Chen <yan.chen@fastly.com>
Co-authored-by: Yan Chen <yan.chen@fastly.com>
vados-cosmonic
force-pushed
the
import-rethrow
branch
from
October 24, 2026 05:08
2b37096 to
b7d6167
Compare
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 24, 2026
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.
Problem
A sync component runs under JSPI and calls an import that rejects or throws. The guest stays suspended forever, and the export's promise never settles.
Imports from sync components that JSPI suspends go through the
CallInterfacetrampoline incrates/js-component-bindgen/src/function_bindgen.rs. When the import throws, the async error branch rejects and exits the task, then returnstask.completionPromise()to the suspended guest.That promise settles only after
#completionReadyis set. The flag is set only for tasks that areisAsyncorisManualAsync. A JSPI-only import task is created withisAsync: falseand noisManualAsync, so the promise never settles.Fix
In the async error branch of
CallInterface, end withthrow err;unless the function is async in the component-model sense (*async_). For those functions, keepreturn task.completionPromise();. Throwing rejects the promise thatWebAssembly.Suspendingis waiting on, so the guest traps and the export rejects, the same as in the sync path.