Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Mar 2019 19:29:20 +0100
From:      Michael Osipov <1983-01-06@gmx.net>
To:        Greg Lewis <glewis@eyesbeyond.com>
Cc:        freebsd-java@freebsd.org
Subject:   Re: First possible bug in OpenJDK 11 port
Message-ID:  <5a4b0586-0e60-4c82-bb6f-d33ea39eaf2c@gmx.net>
In-Reply-To: <20190316061434.GB65278@misty.eyesbeyond.com>
References:  <4706926f-8eb6-c7c6-f982-5ca9c411d5f5@gmx.net> <20190316061434.GB65278@misty.eyesbeyond.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Am 2019-03-16 um 07:14 schrieb Greg Lewis:
> On Sat, Mar 16, 2019 at 12:20:27AM +0100, Michael Osipov wrote:
>> Folks,
>>
>> here is a stripped down example from an issue with the new port:
>>
>>> $ cat ../src/exec/Test.java
>>> package exec;
>>>
>>> import java.io.IOException;
>>>
>>> public class Test {
>>>
>>>      public static void main(String[] args) throws IOException, InterruptedException {
>>>          ProcessBuilder builder = new ProcessBuilder("/bin/sh", "-c", "cd && env");
>>>          builder.inheritIO();
>>>          Process p = builder.start();
>>>          System.out.println("exit code: " + p.waitFor());
>>>      }
>>>
>>> }
>>
>> Fails:
>>> osipovmi@deblndw011x:~/exec/bin
>>> $ /usr/local/openjdk11/bin/java exec.Test
>>> Exception in thread "main" java.io.IOException: Cannot run program "/bin/sh": error=13, Permission denied
>>>      at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
>>>      at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
>>>      at exec.Test.main(Test.java:12)
>>> Caused by: java.io.IOException: error=13, Permission denied
>>>      at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
>>>      at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:341)
>>>      at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:272)
>>>      at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
>>>      ... 2 more
>>
>>
>> as well as
>>> osipovmi@deblndw011x:~/exec/bin
>>> $ /usr/local/bootstrap-openjdk11/bin/java exec.Test
>>> Exception in thread "main" java.io.IOException: Cannot run program "/bin/sh": error=13, Permission denied
>>>      at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
>>>      at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
>>>      at exec.Test.main(Test.java:12)
>>> Caused by: java.io.IOException: error=13, Permission denied
>>>      at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
>>>      at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:341)
>>>      at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:272)
>>>      at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
>>>      ... 2 more
>>
>> and
>>
>>> osipovmi@deblndw011x:~/exec/bin
>>> $ /usr/local/bootstrap-openjdk8/bin/java exec.Test
>>> Exception in thread "main" java.io.IOException: Cannot run program "/bin/sh": error=13, Permission denied
>>>      at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
>>>      at exec.Test.main(Test.java:12)
>>> Caused by: java.io.IOException: error=13, Permission denied
>>>      at java.lang.UNIXProcess.forkAndExec(Native Method)
>>>      at java.lang.UNIXProcess.<init>(UNIXProcess.java:251)
>>>      at java.lang.ProcessImpl.start(ProcessImpl.java:134)
>>>      at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
>>>      ... 1 more
>>
>> but successfully runs with:
>>
>>> osipovmi@deblndw011x:~/exec/bin
>>> $ /usr/local/openjdk8/bin/java exec.Test
>>> SSH_CLIENT=147.54.65.49 55876 22
>>> LOGNAME=osipovmi
>>> LSCOLORS=ExGxFxdxCxDxDxhbadExEx
>>> HTTP_PROXY=http://194.145.60.1:9400
>>> LANG=de_DE.UTF-8
>>> JAVA_HOME=/usr/local/openjdk11
>>> NO_PROXY=localhost .siemens.net .siemens.com .siemens.de
>>> CLICOLOR=YES
>>> MAIL=/var/mail/osipovmi
>>> NCURSES_NO_UTF8_ACS=1
>>> PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
>>> EDITOR=vim
>>> OLDPWD=/net/home/osipovmi/exec/bin
>>> DISPLAY=localhost:10.0
>>> PWD=/net/home/osipovmi
>>> _=/usr/local/openjdk8/bin/java
>>> TERM=xterm
>>> SSH_TTY=/dev/pts/0
>>> USER=osipovmi
>>> HOME=/net/home/osipovmi
>>> SSH_CONNECTION=147.54.65.49 55876 147.54.64.17 22
>>> PS1=\[\033[1;32m\]\u@\h\[\033[0m\]:\[\033[1;34m\]\w\[\033[0m\]\n$
>>> SHELL=/bin/sh
>>> MM_CHARSET=UTF-8
>>> HTTPS_PROXY=http://194.145.60.1:9400
>>> BLOCKSIZE=K
>>> FTP_PROXY=http://194.145.60.1:9400
>>> SHLVL=1
>>> exit code: 0
>>
>> What is causing this issue?
>>
>> For those who'd like to reproduce the bug: Clone Maven GitHub, try to to
>> build from master and see the Maven Surefire Plugin failing when it
>> tried to launch the Surefire Booter.
>>
>> Java 8 Update 202, Java 11 newest from ports. OS is
>>> FreeBSD deblndw011x.ad001.siemens.net 12.0-STABLE FreeBSD 12.0-STABLE r344655 DEBLNDW011X  amd64
> 
> I can reproduce this with the current port in the FreeBSD ports tree.
> 
> It is better behaved with the current code in Github since there has been
> some work done on process handling.  With that code the command executes,
> but afterwards it throws an exception:
> 
> Exception in thread "main" java.lang.RuntimeException: No such process
> 	at java.base/java.lang.ProcessHandleImpl.isAlive0(Native Method)
> 	at java.base/java.lang.ProcessHandleImpl.getInternal(ProcessHandleImpl.java:250)
> 	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:349)
> 	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:272)
> 	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
> 	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
> 	at TestExec.main(TestExec.java:9)
> 
> So there is still some work to do there.  The relevant commit to the github
> repo is likely this one:
> 
> https://github.com/battleblow/openjdk-jdk11u/commit/4cfeb8650f3f90119aa1e52020ac6ad6620a34ff
> 
> This probably means there are still some problems with the
> os_getParentPidAndTimings code given that is what isAlive0 is calling
> (look at ProcessHandleImpl_unix.c).

Hi Greg,

that for the confirmation. Looks like a showstopper for a developer like 
me. Even my webapps won't run because they rely on ProcessBuilder.

Is there anything I can help to get this fixed? That type of C code is, 
unfortunately, out of my knowledge.

I want to verify your (and others) great work against all Maven 
subprojects as well as CodeHaus to find subtile bugsin the port.

Michael



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5a4b0586-0e60-4c82-bb6f-d33ea39eaf2c>