1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 01:29:14 -05:00
denoland-deno/runtime/ops
Andreu Botella ba799b6729
fix(workers): Make worker.terminate() not block the current thread (#13941)
Calling `worker.terminate()` used to kill the worker's isolate and
then block until the worker's thread finished. This blocks the calling
thread if the worker's event loop was blocked in a sync op (as with
`Deno.sleepSync`), which wasn't realized at the time, but since the
worker's isolate was killed at that moment, it would not block the
calling thread if the worker was in a JS endless loop.

However, in #12831, in order to work around a V8 bug, worker
termination was changed to first set a signal to let the worker event
loop know that termination has been requested, and only kill the
isolate if the event loop has not finished after 2 seconds. However,
this change kept the blocking, which meant that JS endless loops in
the worker now blocked the parent for 2 seconds.

As it turns out, after #12831 it is fine to signal termination and
even kill the worker's isolate without waiting for the thread to
finish, so this change does that. However, that might leave the async
ops that receive messages and control data from the worker pending
after `worker.terminate()`, which leads to odd results from the op
sanitizer. Therefore, we set up a `CancelHandler` to cancel those ops
when the worker is terminated.
2022-04-27 18:22:47 +02:00
..
web_worker feat(core): codegen ops (#13861) 2022-03-14 18:44:15 +01:00
fs.rs perf(runtime): read entire files in single ops (#14261) 2022-04-27 16:03:44 +02:00
fs_events.rs feat(ops): custom arity (#13949) 2022-03-14 23:38:53 +01:00
http.rs feat: upgrade to swc_ecmascript 0.137.0 (#14067) 2022-03-22 09:19:53 -04:00
io.rs fix(test): capture worker stdout and stderr in test output (#14410) 2022-04-26 19:00:04 -04:00
mod.rs feat(runtime): two-tier subprocess API (#11618) 2022-04-21 00:20:33 +02:00
os.rs feat(ops): custom arity (#13949) 2022-03-14 23:38:53 +01:00
permissions.rs feat(ops): custom arity (#13949) 2022-03-14 23:38:53 +01:00
process.rs fix(test): capture inherited stdout and stderr for subprocesses in test output (#14395) 2022-04-26 14:46:49 -04:00
runtime.rs feat(ops): custom arity (#13949) 2022-03-14 23:38:53 +01:00
signal.rs fix(runtime/ops/signal.rs): Add Solaris signals (#13931) 2022-03-29 04:00:20 +02:00
spawn.rs fix(test): capture inherited stdout and stderr for subprocesses in test output (#14395) 2022-04-26 14:46:49 -04:00
tty.rs perf(runtime): bypass tokio file and bump op buffer size to 64K (#14319) 2022-04-19 20:11:31 +05:30
utils.rs chore: update copyright to 2022 (#13306) 2022-01-07 22:09:52 -05:00
web_worker.rs feat(ops): custom arity (#13949) 2022-03-14 23:38:53 +01:00
worker_host.rs fix(workers): Make worker.terminate() not block the current thread (#13941) 2022-04-27 18:22:47 +02:00