JDK-8351933 : Inaccurate masking of TC subfield decrement in ForkJoinPool
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.concurrent
  • Affected Version: 11,17,21,25
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2025-03-13
  • Updated: 2025-08-27
  • Resolved: 2025-03-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 21 JDK 24 JDK 25
11-poolUnresolved 17.0.17Fixed 21.0.8Fixed 24.0.2Fixed 25 b15Fixed
Related Reports
Causes :  
Relates :  
Description
When a decrement of TC subfield of ctl (Number of total workers [minus target parallelism in older versions], 16 bit at shift 32) is masked with UMASK (upper bits) mask, it may lead to corruption of RC subfield  (Number of total workers [minus target parallelism], 16 bit at shift 48).

Current mainline code is like

https://github.com/openjdk/jdk/blob/e43960a0170bf29b28ff4733e1c8c927947fb0bb/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java#L2080

The FJP can stop executing tasks. E.g. JDK-8330017
Comments
This should be in JDK 17u before considering 11u.
08-05-2025

This should get a second review before moving forward for JDK 21u.
03-04-2025

Changeset: fed34e46 Branch: master Author: Dmitry Chuyko <dchuyko@openjdk.org> Date: 2025-03-19 11:35:26 +0000 URL: https://git.openjdk.org/jdk/commit/fed34e46b89bc9b0462d9b5f5e5ab5516fe18c6e
19-03-2025

[jdk24u-fix-request] Approval Request from Dmitry Chuyko This a tiny bugfix in ForkJoinPool. At one of code paths the TC subfield of ctl field is decremented and the result is not masked correctly, so the RC subfield is not preserved. In older releases that sometimes leads to a stopped pool, but in 24u it's still a bug. The fix from 25 is applied cleanly.
19-03-2025

[jdk11u-fix-request] Approval Request from Dmitry Chuyko This a tiny bugfix in ForkJoinPool. At one of code paths the TC subfield of ctl field is decremented and the result is not masked correctly, so the RC subfield is not preserved. That sometimes leads to a stopped pool in 17 and 11 [0]. Testing: full jtreg tier1-3 and JCK for multiple supported platforms in the internal Liberica CI. [0] https://bugs.openjdk.org/browse/JDK-8330017
19-03-2025

[jdk17u-fix-request] Approval Request from Dmitry Chuyko This a tiny bugfix in ForkJoinPool. At one of code paths the TC subfield of ctl field is decremented and the result is not masked correctly, so the RC subfield is not preserved. That sometimes leads to a stopped pool in 17 and 11 [0]. Testing: full jtreg tier1-3 and JCK for multiple supported platforms in the internal Liberica CI. [0] https://bugs.openjdk.org/browse/JDK-8330017
19-03-2025

[jdk21u-fix-request] Approval Request from Dmitry Chuyko This a tiny bugfix in ForkJoinPool. At one of code paths the TC subfield of ctl field is decremented and the result is not masked correctly, so the RC subfield is not preserved. In older releases that sometimes leads to a stopped pool, but in 21u it's still a bug. Testing: full jtreg tier1-3 and JCK for multiple supported platforms in the internal Liberica CI.
19-03-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk24u/pull/148 Date: 2025-03-19 12:04:55 +0000
19-03-2025

This is the only site where TC subfield is updated in FJP with a UMASK and the only site with such overflow risks. RC has overflow risks but its overflow does not affect the less significant fields.
17-03-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk11u-dev/pull/3012 Date: 2025-03-13 14:57:19 +0000
13-03-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk17u-dev/pull/3354 Date: 2025-03-13 14:50:23 +0000
13-03-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk21u-dev/pull/1485 Date: 2025-03-13 14:31:42 +0000
13-03-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/24034 Date: 2025-03-13 13:34:51 +0000
13-03-2025