RFR: 8373695: G1: Using a value near integer max for ActiveProcessorCount causes fatal crash [v2]

Jonas Norlinder jnorlinder at openjdk.org
Fri Dec 19 13:50:41 UTC 2025


On Fri, 19 Dec 2025 11:42:05 GMT, Jonas Norlinder <jnorlinder at openjdk.org> wrote:

>> G1ConcRefinementThreads default value depends on ParallelGCThreads which in turn may depend on ActiveProcessorCount. These have different ranges that are valid. Patch will ensure argument setup code never try to assign a value larger than what G1ConcRefinementThreads expects.
>
> Jonas Norlinder has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Limit ParallelGCThreads

Thanks for that heads up! FWIW; At least from my side there is no rushing on getting this one accepted so we can take our time.

> I propose that you just add (max_jint - 1) / wordSize to the ParallelGCThread line, and let that be the entire fix.

Did you mean this?

  product(uint, ParallelGCThreads, 0,                                       \
          "Number of parallel threads parallel gc will use")                \
          range(0, (max_jint-1)/wordSize)                                   \


I don't think that will not solve this bug when `ParallelGCThreads` is heuristically determined and may (i.e. it is defined) depend on ActiveProcessorCount. Applying the above patch and running with `java -XX:+UseG1GC -XX:ActiveProcessorCount=2147483647` results in a fatal crash on my machine. That being said, it do solve the fatal crash that can be triggered with `java -XX:+UseG1GC -XX:ParallelGCThreads=2147483646`.

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

PR Comment: https://git.openjdk.org/jdk/pull/28831#issuecomment-3675152364


More information about the hotspot-gc-dev mailing list