[11u]: RFR CSR backport: JDK-8220362: Add "POSIX_SPAWN" as valid value to jdk.lang.Process.launchMechanism on Linux

Andrew Haley aph at redhat.com
Tue Mar 19 09:39:18 UTC 2019

On 3/19/19 7:33 AM, Thomas Stüfe wrote:

> The established (since decades) method of forking off on Linux JDKs
> has been to use vfork(3). Using vfork is risky. There are chances of
> crashing the parent process. The risk of this happening is very low,
> but not zero.

Do you have a reference to this? If we're at risk, I'd like to know
exactly what the risk is.

> Since analyzing those crashes and attributing them to vfork(3) is
> very difficult, there may be a number of reported cases not
> associated with vfork(3) but in fact caused by it.

> The patch adds a second, safer way to fork off childs, using
> posix_spawn(3). This one has been the default on other platforms for
> quite some while. The patch does not change the default fork mode -
> which remains vfork(3). So installations would not be affected
> unless they explicitely choose to use vfork(3).
> Having this possibility would allow us to use posix_spawn(3) in
> situations where we are analysing crashes and want to exclude
> vfork(3) as a cause. It also would enable us to use posix_spawn(3)
> as a safe alternative by default if we choose to do so.
> In addition to that, as David Loyd mentioned, vfork(3) is marked as
> obsolete and may be vanish at some point in the life span of JDK
> 11. I admit the chance of this happening is low.

Sure, but as I replied to him, this patch doesn't solve that problem.

Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671

More information about the core-libs-dev mailing list