Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8194734

Handle to jimage file inherited into child processes (win)

    Details

    • Subcomponent:
    • Introduced In Version:
      9
    • Resolved In Build:
      b10
    • CPU:
      x86
    • OS:
      windows
    • Verification:
      Not verified

      Description

      FULL PRODUCT VERSION :
      java version "9.0.1"
      Java(TM) SE Runtime Environment (build 9.0.1+11)
      Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 10, Version 1709 (OS Build 16299.125)

      A DESCRIPTION OF THE PROBLEM :
      - unpack the Java 9 Runtime Environment (tar.gz file) to a temporary directory
      - using this JRE launch an external application, e.g. Notepad, and exit the Java application:

      import java.io.*;

      public class LaunchNotepad {
        public static void main(String[] args) throws IOException {
          Runtime.getRuntime().exec(new String[] {"C:\\Windows\\notepad.exe"});
        }
      }

      Notice, that the JRE directory can't be renamed. The reason is that according to Microsoft's ProcessExplorer the Notepad childprocess keeps lib/modules locked. This also happens when launching a second Java VM.

      REGRESSION. Last worked in version 8u144

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_144"
      Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
      Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      After the JRE 9 has exited, no launched application should lock any file inside the JRE directory structure, so the JRE directory can be renamed/removed by the launched application.
      ACTUAL -
      The JRE 9 can not be renamed/removed (even if the JRE has been exited) until the launched application has been exited.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.*;

      public class LaunchNotepad {
        public static void main(String[] args) throws IOException {
          Runtime.getRuntime().exec(new String[] {"C:\\Windows\\notepad.exe"});
        }
      }
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alanb Alan Bateman
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: