-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Module graphs with TLA can hang #3356
Labels
Comments
syg
added a commit
to syg/ecma262
that referenced
this issue
Jun 21, 2024
Closes tc39#3356. Modules that depend on modules with top-level await but do not themselves have a top-level await may currently hang. When a module with TLA finishes evaluating, it triggers evaluation of ancestors modules that depend on it. Currently, ancestors that do not have TLA themselves are evaluated and have their [[Status]] set to ~evaluated~ but incorrectly leaves their [[AsyncEvaluation]] field unchanged as true. This means subsequent importers of those ancestors consider them as in the middle of async evaluation and will wait on them in InnerModuleEvaluation. But since they are already evaluated, those waits cause a hang. This PR sets [[AsyncEvaluation]] to false for those ancestors when their [[Status]] transition to ~evaluated~. Note that the ancestors that error out during evaluation do not need this fix because there is a bail-out path for errored out modules in InnerModuleEvaluation.
ljharb
pushed a commit
to syg/ecma262
that referenced
this issue
Aug 17, 2024
Closes tc39#3356. Modules that depend on modules with top-level await but do not themselves have a top-level await may currently hang. When a module with TLA finishes evaluating, it triggers evaluation of ancestors modules that depend on it. Currently, ancestors that do not have TLA themselves are evaluated and have their [[Status]] set to ~evaluated~ but incorrectly leaves their [[AsyncEvaluation]] field unchanged as true. This means subsequent importers of those ancestors consider them as in the middle of async evaluation and will wait on them in InnerModuleEvaluation. But since they are already evaluated, those waits cause a hang. This PR sets [[AsyncEvaluation]] to false for those ancestors when their [[Status]] transition to ~evaluated~. Note that the ancestors that error out during evaluation do not need this fix because there is a bail-out path for errored out modules in InnerModuleEvaluation. - Set [[AsyncEvaluation]] to false in rejection closure for symmetry
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's a spec bug in step 12.c.iii.1 of AsyncModuleExecutionFulfilled where m.[[Status]] is transitioned to
~evaluated~
but m.[[AsyncEvaluation]] is unchanged. Because m.[[AsyncEvaluation]] remains true, step 11.c.v of InnerModuleEvaluation can add an already-evaluated module as an async parent, which results in a hang.See https://github.com/nicolo-ribaudo/es-modules-tla-bug for a minimal repro.
The text was updated successfully, but these errors were encountered: