RFR: 8254309: appcds GCDuringDump.java failed - class must exist [v2]
Ioi Lam
iklam at openjdk.java.net
Fri Oct 30 20:37:02 UTC 2020
On Fri, 30 Oct 2020 19:02:09 GMT, Yumin Qi <minqi at openjdk.org> wrote:
>> Hi, Please review
>> When CDS at dump time initializes archived heap, some classes are loaded. If at this time system runs out of memory the class will not be loaded. This is what we saw in this bug. The fix checks if OOM happened, if so we print out log and exit gracefully not causing a crash. Added a test case for testing purpose when exception/OOM happens during this stage. Also check during preload classes when OOM happens, exit vm with proper message.
>>
>> Tests: tier1-4
>>
>> Thanks
>> Yumin
>
> Yumin Qi has updated the pull request incrementally with one additional commit since the last revision:
>
> Revise as review comment, add MaxHeapSize in exit message
Changes requested by iklam (Reviewer).
src/hotspot/share/memory/heapShared.cpp line 1055:
> 1053: _dump_time_subgraph_info_table = new (ResourceObj::C_HEAP, mtClass)DumpTimeKlassSubGraphInfoTable();
> 1054:
> 1055: if (_dump_time_subgraph_info_table == nullptr) {
There's no need to check for failure for `new (ResourceObj::C_HEAP, mtClass)`, because it calls this operator:
void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) throw() {
address res = NULL;
switch (type) {
case C_HEAP:
res = (address)AllocateHeap(size, flags, CALLER_PC);
....
which calls
char* AllocateHeap(size_t size,
MEMFLAGS flags,
const NativeCallStack& stack,
AllocFailType alloc_failmode /* = AllocFailStrategy::EXIT_OOM*/) {
char* p = (char*) os::malloc(size, flags, stack);
if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) {
vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "AllocateHeap");
}
which will exit the VM automatically when we run out of C heap.
-------------
PR: https://git.openjdk.java.net/jdk/pull/948
More information about the hotspot-dev
mailing list