RFR: 8373253: Re-work InjectGCWorkerCreationFailure for future changes

Stefan Karlsson stefank at openjdk.org
Thu Dec 11 11:03:25 UTC 2025


On Thu, 11 Dec 2025 10:07:35 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

>> This PR slightly changes when we may `InjectGCWorkerCreationFailure`.  At the moment we wait until `is_init_completed()`. I am changing this to instead be after `_created_workers > 0`. The reason is that we might in the future, https://bugs.openjdk.org/browse/JDK-8367993,  create even more threads "on demand", and if so, we would fail VM creation if we inject worker creation failures after the VM is initiated but before we have created any of the worker threads.
>> 
>> This change should not change the current behaviour. But help future improvements.
>> 
>> I have tested this on `test/hotspot/jtreg/gc/stress/gcold/TestGCOldWithG1.java`, the only place where this flag is tested to my knowledge.
>
> src/hotspot/share/gc/shared/workerThread.cpp line 118:
> 
>> 116: 
>> 117:   if (_created_workers > 0 && InjectGCWorkerCreationFailure) {
>> 118:     assert(is_init_completed(), "Would be interesting to see if this ever happens");
> 
> the assert comment seems vague, probably clearer with just "Initialization not completed"

I agree. This sentence is left-overs from my earlier prototype.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28719#discussion_r2610140210


More information about the hotspot-gc-dev mailing list