diff --git a/test/fuzzer/inspector-fuzzer.cc b/test/fuzzer/inspector-fuzzer.cc index 736195baf5..2a5554396c 100644 --- a/test/fuzzer/inspector-fuzzer.cc +++ b/test/fuzzer/inspector-fuzzer.cc @@ -32,13 +32,6 @@ namespace { base::SmallVector task_runners; -void Terminate() { - for (TaskRunner* r : task_runners) { - r->Terminate(); - r->Join(); - } -} - class UtilsExtension : public IsolateData::SetupGlobalTask { public: ~UtilsExtension() override = default; @@ -88,7 +81,9 @@ class UtilsExtension : public IsolateData::SetupGlobalTask { static TaskRunner* backend_runner_; static void Quit(const v8::FunctionCallbackInfo& args) { - Terminate(); + // Only terminate, so not join the threads here, since joining concurrently + // from multiple threads can be undefined behaviour (see pthread_join). + for (TaskRunner* task_runner : task_runners) task_runner->Terminate(); } static void CompileAndRunWithOrigin( @@ -561,7 +556,7 @@ class Watchdog final : public base::Thread { private: void Run() override { if (semaphore_->WaitFor(kMaxExecutionSeconds)) return; - Terminate(); + for (TaskRunner* task_runner : task_runners) task_runner->Terminate(); } base::Semaphore* const semaphore_; diff --git a/test/fuzzer/inspector/empty b/test/fuzzer/inspector/empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/fuzzer/inspector/foo b/test/fuzzer/inspector/foo deleted file mode 100644 index 40ca6a920c..0000000000 --- a/test/fuzzer/inspector/foo +++ /dev/null @@ -1 +0,0 @@ -smoke test diff --git a/test/fuzzer/inspector/invalid b/test/fuzzer/inspector/invalid new file mode 100644 index 0000000000..4476525b2a --- /dev/null +++ b/test/fuzzer/inspector/invalid @@ -0,0 +1 @@ +no valid javascript diff --git a/test/inspector/inspector-test.cc b/test/inspector/inspector-test.cc index e33ddca169..b9aa6c6838 100644 --- a/test/inspector/inspector-test.cc +++ b/test/inspector/inspector-test.cc @@ -41,13 +41,6 @@ namespace { base::SmallVector task_runners; -void Terminate() { - for (TaskRunner* task_runner : task_runners) { - task_runner->Terminate(); - task_runner->Join(); - } -} - class UtilsExtension : public IsolateData::SetupGlobalTask { public: ~UtilsExtension() override = default; @@ -154,7 +147,9 @@ class UtilsExtension : public IsolateData::SetupGlobalTask { static void Quit(const v8::FunctionCallbackInfo& args) { fflush(stdout); fflush(stderr); - Terminate(); + // Only terminate, so not join the threads here, since joining concurrently + // from multiple threads can be undefined behaviour (see pthread_join). + for (TaskRunner* task_runner : task_runners) task_runner->Terminate(); } static void Setlocale(const v8::FunctionCallbackInfo& args) {