RFR: 8325621: Improve jspawnhelper version checks [v3]

Aleksey Shipilev shade at openjdk.org
Wed Mar 13 10:29:13 UTC 2024


On Tue, 12 Mar 2024 19:22:25 GMT, Chad Rakoczy <duke at openjdk.org> wrote:

>> Fix for [8325621](https://bugs.openjdk.org/browse/JDK-8325621)
>> 
>> Updates jspawnhelper to check that JDK version and jspawnhelper version are the same. Updates test to include check for version. Also tested manually by replacing jspawnhelper with incorrect version to confirm that check works.
>
> Chad Rakoczy has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Print to stdout instead of stderr
>  - Compare version using VERSION_STRING

I was thinking what would happen for the first time we upgrade jspawnhelper like this. There would be no helpful message then, the `jspawnhelper` would just exit on argument count check. So I suggest we polish the failure messages a bit: always report version at `shutItDown`, and report more verbose failure messages too.

See: [jspawnhelper-messages-1.patch](https://github.com/openjdk/jdk/files/14586196/jspawnhelper-messages-1.patch)

Older JDK invoking new jspawnhelper would then fail like:


% build/macosx-aarch64-server-fastdebug/images/jdk/lib/jspawnhelper 1:1:1
Incorrect number of arguments: 2
jspawnhelper version 23-internal-adhoc.shipilev.shipilev-jdk
This command is not for general use and should only be run as the result of a call to
ProcessBuilder.start() or Runtime.exec() in a java application

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

PR Comment: https://git.openjdk.org/jdk/pull/18204#issuecomment-1994051562


More information about the core-libs-dev mailing list