On Fri, 1 Mar 2024 01:50:46 GMT, Vladimir Petko <vpe...@openjdk.org> wrote:

> This MR fixes segsegv in jspawnhelper when it is called without args. 
> This scenario happens when a long running Java process is not restarted 
> during upgrade. 
> 
> It updates test/jdk/java/lang/ProcessBuilder/JspawnhelperProtocol.java to 
> check that jspawnhelper exits with code 1:
> 
> After test update:
> 
> $ make CONF=linux-x86_64-server-fastdebug test 
> TEST=test/jdk/java/lang/ProcessBuilder/JspawnhelperProtocol.java
> ...
> Running jspawnhelper without args
> STDERR:
> java.lang.Exception: Parent process exited with 12
>         at 
> JspawnhelperProtocol.simulateJspawnhelperWithoutArgs(JspawnhelperProtocol.java:126)
>         at JspawnhelperProtocol.main(JspawnhelperProtocol.java:267)
>         at 
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
>         at java.base/java.lang.reflect.Method.invoke(Method.java:580)
>         at 
> com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
>         at java.base/java.lang.Thread.run(Thread.java:1575)
> ...
> ==============================
> Test summary
> ==============================
>    TEST                                              TOTAL  PASS  FAIL ERROR  
>  
>    jtreg:test/jdk/java/lang/ProcessBuilder/JspawnhelperProtocol.java
>>>                                                       1     0     1     0 <<
> ==============================
> TEST FAILURE
> 
> After jspawnhelper change the test passes:
> 
> ==============================
> Test summary
> ==============================
>    TEST                                              TOTAL  PASS  FAIL ERROR  
>  
>    jtreg:test/jdk/java/lang/ProcessBuilder/JspawnhelperProtocol.java
>                                                          1     1     0     0  
>  
> ==============================
> TEST SUCCESS
> 
> 
> The user will see the following output in the logs:
> 
> An earlier version of Java is trying to call jspawnhelper.
> Please restart Java process.
> Exception in thread "main" java.io.IOException: Cannot run program "ls": 
> error=0, Failed to exec spawn helper: pid: 2168121, exit value: 1
>         at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
>         at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
>         at Test.main(Test.java:3)
> Caused by: java.io.IOException: error=0, Failed to exec spawn helper: pid: 
> 2168121, exit value: 1
>         at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
>         at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:314)
>         at java.base/java.lang.ProcessIm...

Would it be possible to expand a bit on what is going on here? Are you saying 
that in the course of upgrading a JDK that you somehow get into a state where 
jspawnhelper has been replaced with a version from a newer JDK? Is the real 
issue here that the upgrade didn't shutdown the application and/or something 
copied over an existing installation during the upgrade?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/18074#issuecomment-1972674199

Reply via email to