RFR: 8353439: Shell grouping of -XX:OnError= commands is surprising [v3]

Thomas Stuefe stuefe at openjdk.org
Tue Apr 8 09:57:16 UTC 2025


On Mon, 7 Apr 2025 10:44:02 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

>> We should be consistent, and run all OnError items in a new shell.  Currently the ; separator causes a new shell, but multiple -XX:OnError= options are grouped into the same shell.
>> 
>> next_OnError_command() decides on where a new command starts.  It should recognise newlines, and all commands will get their own shell.
>
> Kevin Walls has updated the pull request incrementally with one additional commit since the last revision:
> 
>   comment

Hmm. 

May there not be customers that specify a verbatim "spelled out" shell script as input for OnError? This is a behavior change.

And if not (if the commands issued with OnError, separated by ;, are in turn real commands, programs or scripts): Those, before, were forked off as separate grandchilds to the same parent (the direct child), right? Whereas now we have a single parent for each grandchild process. But here, especially if OnError had been called as reaction to an OOM condition by a gigantic JVM, reusing that in-between shell may be preferable. Forking off a large process can be expensive.

(Obviously, its all undocumented, which is bad in itself).

All of these are questions - I may not know the full story.

src/hotspot/share/utilities/vmError.cpp line 156:

> 154: 
> 155:   const char * cmdend = cmd;
> 156:   while (*cmdend != '\0' && *cmdend != ';' && *cmdend != '\n') cmdend++;

What happens if I specify, eg in Bash:

-XX:OnError=lengthy command \
  more command options

?

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

PR Review: https://git.openjdk.org/jdk/pull/24354#pullrequestreview-2749347538
PR Review Comment: https://git.openjdk.org/jdk/pull/24354#discussion_r2032811356


More information about the hotspot-dev mailing list