From 115dedde22edc60707826c4073e0ee90431b86f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 25 Apr 2024 06:32:01 +0100 Subject: fix: unref stdin read (#23534) Closes https://github.com/denoland/deno_core/issues/648 Co-authored-by: Matt Mastracci --- runtime/tokio_util.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/tokio_util.rs b/runtime/tokio_util.rs index 6ae81167e..da6e8b221 100644 --- a/runtime/tokio_util.rs +++ b/runtime/tokio_util.rs @@ -99,7 +99,13 @@ where #[cfg(not(tokio_unstable))] let join_handle = rt.spawn(future); - rt.block_on(join_handle).unwrap().into_inner() + let r = rt.block_on(join_handle).unwrap().into_inner(); + // Forcefully shutdown the runtime - we're done executing JS code at this + // point, but there might be outstanding blocking tasks that were created and + // latered "unrefed". They won't terminate on their own, so we're forcing + // termination of Tokio runtime at this point. + rt.shutdown_background(); + r } #[inline(always)] -- cgit v1.2.3