From 3d993accaa14de0049ba964beefd349a3faa0b7e Mon Sep 17 00:00:00 2001 From: Leo Korinth Date: Wed, 14 Jan 2026 14:09:54 +0100 Subject: [PATCH] Revert "8373253: Re-work InjectGCWorkerCreationFailure for future changes" This reverts commit d45ea8817ab2303b2decd8cbb2cd1bf5280aa181. --- src/hotspot/share/gc/shared/workerThread.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/hotspot/share/gc/shared/workerThread.cpp b/src/hotspot/share/gc/shared/workerThread.cpp index b3cec90cb42..3a999da59dc 100644 --- a/src/hotspot/share/gc/shared/workerThread.cpp +++ b/src/hotspot/share/gc/shared/workerThread.cpp @@ -94,6 +94,9 @@ void WorkerThreads::initialize_workers() { } WorkerThread* WorkerThreads::create_worker(uint name_suffix) { + if (is_init_completed() && InjectGCWorkerCreationFailure) { + return nullptr; + } WorkerThread* const worker = new WorkerThread(_name, name_suffix, &_dispatcher); @@ -114,13 +117,6 @@ uint WorkerThreads::set_active_workers(uint num_workers) { "Invalid number of active workers %u (should be 1-%u)", num_workers, _max_workers); - if (_created_workers > 0 && InjectGCWorkerCreationFailure) { - assert(is_init_completed(), "Would be interesting to see if this ever happens"); - log_error(gc, task)("Failed to create worker thread (InjectGCWorkerCreationFailure)"); - _active_workers = MIN2(_created_workers, num_workers); - return _active_workers; - } - while (_created_workers < num_workers) { WorkerThread* const worker = create_worker(_created_workers); if (worker == nullptr) {