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

Java inherits handle of "modules" file to sub-processes

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      A DESCRIPTION OF THE PROBLEM :
      The JavaVM opens a handle to the file "lib/modules" and sets its inherit attribute to true. As the java.lang.ProcessBuilder also executes new processes with the inherit flag set to true, this handle is inherited to subprocesses. See http://hg.openjdk.java.net/jdk10/sandbox/jdk/file/94d5e1b00394/src/java.base/windows/native/libjava/ProcessImpl_md.c
      So subprocesses are not able to modify/delete this file.
      My usecase: From a hostapp I want to execute a Updater-App with a separate java installation and then let the Updater install a new hostapp version. Therefore I also need to replace the java binaries of the standalone hostapp.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      You need two java installations (first one must be Java10)
      - Create a simple app that runs an infinite loop (App2)
      - Create another app (App1) that executes App2 with java.lang.ProcessBuilder and then exits. Use the second VM to execute the app.
      - Execute App1 in the first VM
      - Use a tool like ProcessHacker to find all open handles of the running App2
      -> You will see that there is an open handle to the file "modules" of the Java10 installation



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The JavaVM should not open inherited handles on files. Also ProcessBuilder should not inherit handles to subprocesses.
      ACTUAL -
      The JavaVM opens inherited handles on the file "lib/modules". ProcessBuilder inherits handles to subprocesses.

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: