RFR: 8373695: G1: Using a value near integer max for ActiveProcessorCount causes fatal crash [v2]
Stefan Karlsson
stefank at openjdk.org
Fri Dec 19 12:26:42 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
I propose that you just add `(max_jint - 1) / wordSize` to the ParallelGCThread line, and let that be the entire fix.
I'm always hesitant to adding globals, functions, and classes to CollectedHeap. It requires extra motivation and acceptance from devs for all GCs. Often the proposal isn't a perfect fit for all GCs and we'll have to clean it out later. Here it is not clear if "WorkerThreadLimit" applies to all GCs. For example, ZGC could theoretically use more worker threads via ConcGCThreads. Not that anyone would, but I'm bringing this up to show a point that messing with CollectedHeap will likely make your PR a bit controversial and delay its review.
Another concern about this is that we haven't figured out a good, and unified way to bring constants into our GC flag cross-macros. I'd prefer if we could figure that out in a context of a separate RFE/discussion instead of in a bug fix.
Then we can see if our prioritize to figure out a good way to specify constants for our flag ranges rise to the level where we can sit down and figure out a clean way to do that.
-------------
Changes requested by stefank (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/28831#pullrequestreview-3598425706
More information about the hotspot-gc-dev
mailing list