Hi David, spot on ! jspawnhelper had no execution permission (i overlook that in my installation process).
I wonder if the exception message can be improved to indicate that the issue is on jspawnhelper and not on the program i want to execute. Thanks a lot, Rémi ----- Mail original ----- > De: "David Lloyd" <david.ll...@redhat.com> > À: "Remi Forax" <fo...@univ-mlv.fr> > Cc: "core-libs-dev" <core-libs-dev@openjdk.java.net>, "Roger Riggs" > <roger.ri...@oracle.com>, "Alan Bateman" > <alan.bate...@oracle.com> > Envoyé: Samedi 11 Mai 2019 17:14:56 > Objet: Re: Process.exec with the linux posix_spawn mode has a bug > On Sat, May 11, 2019 at 9:49 AM Remi Forax <fo...@univ-mlv.fr> wrote: >> >> I've seen a weird error on my CI [1] since the 15th of February when using >> the >> jdk 13, >> i was not able to run jshell* using the programmatic API (java tool) anymore. >> >> Yesterday, i took the time to track that issue and i believe i've found the >> root >> cause, trying to execute the java launcher using ProcessBuilder.start() with >> the jdk 13 sometimes fails with an i/o exception (errno 13) which is weird >> because you are trying to execute the same process that the one you are >> executing. Note that this is a spurious bug, I was not able to find the exact >> condition that triggers that bug. >> So sometime it works, sometime it doesn't. > > Assuming you're running on Linux (given that the changeset only > applies to Linux), errno 13 is EACCES which would indicate a > filesystem permission issue. Are you sure you have permission to > execute `jspawnhelper` in your JVM installation? Could there be an > SELinux restriction in place? > > Here's what the man page says: > > ``` > > [EACCES] Search permission is denied for a component of > the path prefix. > > > [EACCES] The new process file is not an ordinary file. > > > [EACCES] The new process file mode denies execute permission. > > > [EACCES] The new process file is on a filesystem > mounted with execution > > disabled (MNT_NOEXEC in <sys/mount.h>). > ``` > >> If i pass -Djdk.lang.Process.launchMechanism=fork (or vfork) when starting >> the >> VM, the bug disappear meaning that the bug occurs when the VM is trying to >> use >> posix_spawn, perhaps spawn is trying to do an optimization when you try to >> execute the same process as the one you are running under some conditions ? > > The posix_spawn approach executes an intermediate support process > (`jspawnhelper`) which in turn executes the target process. I believe > there's an extensive discussion on the reasons for this in the > `core-libs-dev` archive. > > > -- > - DML