RFR: 8351933: Inaccurate masking of TC subfield decrement in ForkJoinPool [v2]

Dmitry Chuyko dchuyko at openjdk.org
Tue Mar 18 09:11:00 UTC 2025


> Please review a tiny fix in the ForkJoinPool. Since JDK 9 (JDK-8134852 [1]) in one case when TC subfield in ctl field is decremented, the applied masking (UMASK, upper bits) may not preserve neighbor RC subfield sometimes. In JDKs prior to 19 FJP may stop executing tasks, which requires a long running application restart [2]. Since 19 it is even harder to reproduce because of the separate parallelism field.
> 
> The fix is to replace 'UMASK & (c - TC_UNIT)'  with '(c & RC_MASK) | ((c - TC_UNIT)  & TC_MASK)' which preserves the RC part of the compareAndSetCtl() candidate argument. On 17u and 11u that repairs known tests and applications. This PR is for the mainline, and I intend to backport it to 21u, 17u and 11u.
> 
> [1] https://bugs.openjdk.org/browse/JDK-8134852
> [2] https://bugs.openjdk.org/browse/JDK-8330017

Dmitry Chuyko has updated the pull request incrementally with one additional commit since the last revision:

  Aligned with JDK-8319447

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24034/files
  - new: https://git.openjdk.org/jdk/pull/24034/files/e5517c7d..973c84cd

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24034&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24034&range=00-01

  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/24034.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24034/head:pull/24034

PR: https://git.openjdk.org/jdk/pull/24034


More information about the core-libs-dev mailing list