8373695: G1: Using a value near integer max for ActiveProcessorCount causes fatal crash#28831
8373695: G1: Using a value near integer max for ActiveProcessorCount causes fatal crash#28831JonasNorlinder wants to merge 4 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back jnorlinder! A progress list of the required criteria for merging this PR into |
|
@JonasNorlinder This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 238 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@stefank, @tschatzl) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
@JonasNorlinder The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
stefank
left a comment
There was a problem hiding this comment.
Could an alternative be to limit ParallelGCThreads?
|
Thanks for the suggestion Stefan. Thomas had the same comment and I’m open to it. But are we OK with using the upper bound limited by G1ConcRefinementThreads? |
Not sure what the question is, but limiting |
|
FYI; I noticed that applying a limit on ParallelGCThreads still makes it possible to sneak in a larger value with ActiveProcessorCount. Looking into the interaction with ActiveProcessorCount with the rest of the code |
stefank
left a comment
There was a problem hiding this comment.
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.
|
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.
Did you mean this? I don't think that will not solve this bug when |
Yes.
My comment was made in the context provided before you found that issue. |
| constexpr uint MaxG1ConcRefinementThreads = (max_jint - 1) / wordSize; // Derived from flag declaration | ||
| FLAG_SET_ERGO(G1ConcRefinementThreads, MIN2(ParallelGCThreads, MaxG1ConcRefinementThreads)); |
There was a problem hiding this comment.
Maybe use the flags API to programmatically get the maximum instead of hardcoding the value, something like this:
const JVMTypedFlagLimit<uint>* conc_refinement_threads_limits = JVMFlagLimit::get_range_at(FLAG_MEMBER_ENUM(G1ConcRefinementThreads))->cast<uint>();
FLAG_SET_ERGO(G1ConcRefinementThreads, MIN2(ParallelGCThreads, conc_refinement_threads_limits->max()));
|
/integrate |
|
@JonasNorlinder |
|
/sponsor |
|
Going to push as commit a855224.
Your commit was automatically rebased without conflicts. |
|
@tschatzl @JonasNorlinder Pushed as commit a855224. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
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.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28831/head:pull/28831$ git checkout pull/28831Update a local copy of the PR:
$ git checkout pull/28831$ git pull https://git.openjdk.org/jdk.git pull/28831/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28831View PR using the GUI difftool:
$ git pr show -t 28831Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28831.diff
Using Webrev
Link to Webrev Comment