From c4c48f30b1b0fd601bb7564a142ce9dbe652204a Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Tue, 9 Nov 2021 14:17:27 -0800 Subject: [PATCH] v8: fix segfault during concurrent isolate creation/disposal on Windows (#829) This patch includes a test for this issue. The V8 patch is intentionally left simple to avoid merge conflicts in the future. To be landed upstream, the `unwindinfo_use_count_` would probably have to be made non-atomic and we'd have to add a cctest. Upstream bug: https://bugs.chromium.org/p/v8/issues/detail?id=12393 Fixes: #714 --- ...oncurrent_isolate_creation_and_disposal.rs | 28 +++++++++++++++++++ v8 | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/test_concurrent_isolate_creation_and_disposal.rs diff --git a/tests/test_concurrent_isolate_creation_and_disposal.rs b/tests/test_concurrent_isolate_creation_and_disposal.rs new file mode 100644 index 00000000..f4000be6 --- /dev/null +++ b/tests/test_concurrent_isolate_creation_and_disposal.rs @@ -0,0 +1,28 @@ +use std::iter::repeat_with; +use std::thread; + +#[test] +fn concurrent_isolate_creation_and_disposal() { + let platform = v8::new_single_threaded_default_platform(false).make_shared(); + v8::V8::initialize_platform(platform); + v8::V8::initialize(); + + for round in 0..1000 { + eprintln!("round {}", round); + + let threads = repeat_with(|| { + thread::spawn(|| { + v8::Isolate::new(Default::default()); + }) + }) + .take(16) + .collect::>(); + + for join_handle in threads { + join_handle.join().unwrap(); + } + } + + unsafe { v8::V8::dispose() }; + v8::V8::shutdown_platform(); +} diff --git a/v8 b/v8 index 3049eb2b..67722327 160000 --- a/v8 +++ b/v8 @@ -1 +1 @@ -Subproject commit 3049eb2bff7f8235b85d1759e55001c151a717d2 +Subproject commit 67722327985937ee5fb5b40adab8de1c59b46e62