First possible bug in OpenJDK 11 port
Michael Osipov
1983-01-06 at gmx.net
Wed Mar 20 12:50:04 UTC 2019
Am 2019-03-17 um 18:24 schrieb Greg Lewis:> On Sat, Mar 16, 2019 at
07:29:20PM +0100, Michael Osipov wrote:
>> 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 at 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 at 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 at 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 at 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.
>
> The github repo now has a fix. The good way to help verify would be to
> run the inbuilt tests. I haven't got set up to do that yet, but the
> openjdk8 port has a test target that could be ported over.
Hi Greg,
I cloned the repo and have built it. The tests (make test) fail to
compile/run, but the code works flawlessly. I tried maven.git,
maven-intergration-testing.git, maven-scm.git, maven-wagon.git and other
crucial components (from Codehaus Plexus). They all compile and pass
flawlessly. I will additionally try several native ones like Hawt JNI,
Commons Daemon and Tomcat Native.
Thank you very much for the fix!
Michael
More information about the freebsd-java
mailing list