JDK-8229899 : java.io.File.isInvalid() is racy
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 8,11,13,14
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-08-19
  • Updated: 2020-07-28
  • Resolved: 2019-08-20
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 Other
11.0.6Fixed openjdk7uFixed
Related Reports
Relates :  
    final boolean isInvalid() {
        if (status == null) {
            status = (this.path.indexOf('\u0000') < 0) ? PathStatus.CHECKED
                                                       : PathStatus.INVALID;
        return status == PathStatus.INVALID;
If the reads to "status" are reordered and another thread writes to "status", the return value can be wrong.
Reading "status" to a local variable fixes the issue.
Fix request (13u): I'd like to port it to 13u as well. Patch applies cleanly, test run is OK.

Fix Request (8u) Same reason as for 11u. Patch applies cleanly to 8u, passes tier1 tests.

Fix Request (11u) This fixes a subtle data race that can silently break File APIs (isInvalid is private, but used in many public File methods). Patch applies cleanly to 11u, passes tier1, tier2 tests.

URL: https://hg.openjdk.java.net/jdk/jdk/rev/a445d4305fad User: aeubanks Date: 2019-08-20 15:27:49 +0000

Introduced by JDK-8003992 in 8.