jdk17u-dev icon indicating copy to clipboard operation
jdk17u-dev copied to clipboard

8351933: Inaccurate masking of TC subfield decrement in ForkJoinPool

Open dchuyko opened this issue 8 months ago • 7 comments
trafficstars

This a backport of JDK-8351933 [0] (PR [1]) for 17u. At one of code paths the TC subfield of ctl field is decremented and the result is not masked correctly. As a result, the FJP may stop executing tasks [2]. The target code is in awaitWork() instead of tryTrim() and the surrounding code is different from the current master, as well as the original mask name. The core change is the same, candidate for compareAndSetCtl() is constructed using '(c & RC_MASK) | ((c - TC_UNIT) & TC_MASK)' instead of '(UC_MASK & (c - TC_UNIT))' to correctly preserve the RC subfield.

[0] https://bugs.openjdk.org/browse/JDK-8351933 [1] https://github.com/openjdk/jdk/pull/24034 [2] https://bugs.openjdk.org/browse/JDK-8330017


Progress

  • [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue
  • [ ] JDK-8351933 needs maintainer approval

Issue

  • JDK-8351933: Inaccurate masking of TC subfield decrement in ForkJoinPool (Bug - P4 - Requested)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/3354/head:pull/3354
$ git checkout pull/3354

Update a local copy of the PR:
$ git checkout pull/3354
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/3354/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3354

View PR using the GUI difftool:
$ git pr show -t 3354

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/3354.diff

Using Webrev

Link to Webrev Comment

dchuyko avatar Mar 13 '25 14:03 dchuyko