fix(workers): Make worker.terminate() not immediately kill the isolate (#12831)

Due to a bug in V8, terminating an isolate while a module with top-level
await is being evaluated would crash the process. This change makes it
so calling `worker.terminate()` will signal the worker to terminate at
the next iteration of the event loop, and it schedules a proper
termination of the worker's isolate after 2 seconds.
This commit is contained in:
Andreu Botella 2021-11-29 13:37:44 +01:00 committed by GitHub
parent 5178e093ed
commit 4a13c320d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 96 additions and 21 deletions

View file

@ -99,3 +99,8 @@ itest!(worker_permissions_blob_local {
http_server: true,
exit_code: 1,
});
itest!(worker_terminate_tla_crash {
args: "run --quiet --reload workers/terminate_tla_crash.js",
output: "workers/terminate_tla_crash.js.out",
});