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

Add "POSIX_SPAWN" as valid value to jdk.lang.Process.launchMechanism on Linux

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 12
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Hide
      On Linux, POSIX_SPAWN is now an accepted value where beforehand it would be rejected with a java.lang.Error upon launch:

      % java -Djdk.lang.Process.launchMechanism=POSIX_SPAWN ...
      "java.lang.Error: POSIX_SPAWN is not a supported process launch mechanism on this platform."

      Other platforms are not affected.
      Show
      On Linux, POSIX_SPAWN is now an accepted value where beforehand it would be rejected with a java.lang.Error upon launch: % java -Djdk.lang.Process.launchMechanism=POSIX_SPAWN ... "java.lang.Error: POSIX_SPAWN is not a supported process launch mechanism on this platform." Other platforms are not affected.
    • Interface Kind:
      System or security property, Other
    • Scope:
      JDK

      Backports

        Description

        Summary

        Make POSIX_SPAWN a valid value for -Djdk.lang.Process.launchMechanism on Linux.

        Problem

        It is planned to phase out support for vfork() on Linux and to switch to using posix_spawn() like all other *nixes do today already. The first step toward that is to provide POSIX_SPAWN as an addition non-default option for -Djdk.lang.Process.launchMechanism.

        Solution

        The implementation already exists and is in use (by default) on our other *nix platforms (BSD/MacOS, Solaris, AIX). We only have to enable that implementation for Linux as well.

        Specification

        When -Djdk.lang.Process.launchMechanism=POSIX_SPAWN is specified, posix_spawn() will be used instead of the default vfork() to fork off child processes. The implementation is the same which is already in use on other Unices, just extended to Linux.

        What internally happens depends on the underlying libc implementation:

        1) on glibc versions >= 2.4 but smaller than 2.23, posix_spawn will use a combination of vfork() and exec(). 2) on glibc versions > 2.24 and on muslc, clone() is used with (CLONE_VM, CLONE_VFORK). 3) on very old glibc versions (<2.4), posix_spawn() will use fork()/exec().

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  stuefe Thomas Stuefe
                  Reporter:
                  stuefe Thomas Stuefe
                  Reviewed By:
                  Alan Bateman, Roger Riggs
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: