Date: Wed, 20 Mar 2019 13:44:40 +0100 From: Michael Osipov <1983-01-06@gmx.net> To: freebsd-java@freebsd.org Subject: Re: First possible bug in OpenJDK 11 port Message-ID: <a1290fc0-d7c1-dc7d-46fa-15deef66ae1a@gmx.net> In-Reply-To: <20190317172446.GA17718@misty.eyesbeyond.com> References: <4706926f-8eb6-c7c6-f982-5ca9c411d5f5@gmx.net> <20190316061434.GB65278@misty.eyesbeyond.com> <5a4b0586-0e60-4c82-bb6f-d33ea39eaf2c@gmx.net> <20190317172446.GA17718@misty.eyesbeyond.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 =3D new ProcessBuilder("/bin/sh", "-c", "cd && env"); >>>>> builder.inheritIO(); >>>>> Process p =3D 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=3D13, 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=3D13, Permission denied >>>>> at java.base/java.lang.ProcessImpl.forkAndExec(Native Method) >>>>> at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:34= 1) >>>>> 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=3D13, 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=3D13, Permission denied >>>>> at java.base/java.lang.ProcessImpl.forkAndExec(Native Method) >>>>> at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:34= 1) >>>>> 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=3D13, Permission denied >>>>> at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) >>>>> at exec.Test.main(Test.java:12) >>>>> Caused by: java.io.IOException: error=3D13, 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=3D147.54.65.49 55876 22 >>>>> LOGNAME=3Dosipovmi >>>>> LSCOLORS=3DExGxFxdxCxDxDxhbadExEx >>>>> HTTP_PROXY=3Dhttp://194.145.60.1:9400 >>>>> LANG=3Dde_DE.UTF-8 >>>>> JAVA_HOME=3D/usr/local/openjdk11 >>>>> NO_PROXY=3Dlocalhost .siemens.net .siemens.com .siemens.de >>>>> CLICOLOR=3DYES >>>>> MAIL=3D/var/mail/osipovmi >>>>> NCURSES_NO_UTF8_ACS=3D1 >>>>> PATH=3D/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin >>>>> EDITOR=3Dvim >>>>> OLDPWD=3D/net/home/osipovmi/exec/bin >>>>> DISPLAY=3Dlocalhost:10.0 >>>>> PWD=3D/net/home/osipovmi >>>>> _=3D/usr/local/openjdk8/bin/java >>>>> TERM=3Dxterm >>>>> SSH_TTY=3D/dev/pts/0 >>>>> USER=3Dosipovmi >>>>> HOME=3D/net/home/osipovmi >>>>> SSH_CONNECTION=3D147.54.65.49 55876 147.54.64.17 22 >>>>> PS1=3D\[\033[1;32m\]\u@\h\[\033[0m\]:\[\033[1;34m\]\w\[\033[0m\]\n$ >>>>> SHELL=3D/bin/sh >>>>> MM_CHARSET=3DUTF-8 >>>>> HTTPS_PROXY=3Dhttp://194.145.60.1:9400 >>>>> BLOCKSIZE=3DK >>>>> FTP_PROXY=3Dhttp://194.145.60.1:9400 >>>>> SHLVL=3D1 >>>>> 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 proces= s >>> at java.base/java.lang.ProcessHandleImpl.isAlive0(Native Method) >>> at java.base/java.lang.ProcessHandleImpl.getInternal(ProcessHandleImpl.java:2= 50) >>> 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/4cfeb8650f3f90119aa1e5= 2020ac6ad6620a34ff >>> >>> 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 li= ke >> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a1290fc0-d7c1-dc7d-46fa-15deef66ae1a>