RFR: 10: 8177522: -XX:OnOutOfMemoryError does not work if supplied twice on windows

David Holmes david.holmes at oracle.com
Thu Apr 27 07:39:42 UTC 2017

Hi Vladimir,

Thanks for fixing this.

On 26/04/2017 7:58 PM, Vladimir Kempik wrote:
> Hello
> Please review this fix for bug JDK-8177522
> <https://bugs.openjdk.java.net/browse/JDK-8177522>
> The issue is windows only.
> When two OnOutOfMemoryError options are passed to java, they are
> combined using '\n' as separator.
> But when OnError parses the string, it only knows ';' as separator of
> commands.
> On nix systems it works fine because the command with '\n' in it are
> passed to shell where it executed fine.
> With this patch I'm making windows routine to behave similary to nix,
> passing command to cmd.exe for execution, I just have to replace all
> '\n' with '&'.

Overall this approach looks good to me.


+   char * cmd_prefix = "cmd /C ";

Should that be cmd.exe as in vmError.cpp?

Two nits:

+ // now replace all '\n' with '&'

Comment should be indented 2 spaces.

+   while ((substring = strchr (substring, '\n')) != NULL) {

Remove space after strchr.



I'm wondering though, do we need to modify the vmError code given we 
will add the "cmd.exe /C" prefix in fork_and_exec anyway?



The test should test both a single -XX:OnOutOfMemoryError, and multiple 


> Such workaround is needed to not break compatibility with existing systems.
> Testing: jprt, included testcase.
> Webrev - http://cr.openjdk.java.net/~vkempik/8177522/webrev.00/
> Bug - https://bugs.openjdk.java.net/browse/JDK-8177522
> Thanks, Vladimir

More information about the hotspot-runtime-dev mailing list