RFR: 8303422: Use a common functions to exit the VM for -Xshare:dump and CDS errors [v3]

Coleen Phillimore coleenp at openjdk.org
Fri Apr 14 18:56:35 UTC 2023


On Fri, 14 Apr 2023 17:15:19 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

>> Currently, we have ad-hoc calls to os::_exit(0), vm_exit_during_initialization() and vm_direct_exit() in cases where there are dumptime or runtime errors for CDS. This patch introduces intuitively named methods for exiting the VM when there are dumptime/runtime errors and when dumping is finished. Verified with tier 1-4 tests.
>
> Matias Saavedra Silva has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Coleen and Ioi comments

src/hotspot/share/cds/archiveUtils.cpp line 167:

> 165:       // happens only if you allocate more than 2GB of shared objects and would require
> 166:       // millions of shared classes.
> 167:       MetaspaceShared::unrecoverable_writing_error("Out of memory in the CDS archive\nPlease reduce the number of shared classes.");

This should probably be two log_error() messages rather than a two line message with a \n in it.  Or remove the \n and add a period and blank, to fix the original message.  There aren't typically multiline comments with \n in the jvm.

src/hotspot/share/cds/metaspaceShared.cpp line 313:

> 311:       // buf_len will overflown 32-bit value.
> 312:       log_error(cds)("string length too large: %d", utf8_length);
> 313:       unrecoverable_loading_error();

Even though this call (and the one above) are in MetaspaceShared class scope, I think both should be preceded with MetaspaceShared:: for consistency and in case it gets moved.

src/hotspot/share/classfile/stringTable.cpp line 799:

> 797:       // refer to more than 16384 * 16384 = 26M interned strings! Not a practical concern
> 798:       // but bail out for safety.
> 799:       MetaspaceShared::unrecoverable_writing_error(err_msg("Too many strings to be archived: %ld", _items_count));

Why is log_error() removed and passed to unrecoverable_writing_error?  Seems like this is breaking the rule of simple strings can be passed to unrecoverable_writing_error().  The inconsistency of passing a message vs logging outside the call is very strange to me.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13463#discussion_r1167181655
PR Review Comment: https://git.openjdk.org/jdk/pull/13463#discussion_r1167184934
PR Review Comment: https://git.openjdk.org/jdk/pull/13463#discussion_r1167175783


More information about the hotspot-runtime-dev mailing list