RFR: 8246405: Add GCLogPrecious functionality to log and report debug errors

Stefan Karlsson stefan.karlsson at oracle.com
Wed Jun 3 08:42:07 UTC 2020


Hi all,

Please review this patch to enhance the GCLogPrecious functionality 
(JDK-8246405) to add support for a way to both log and generate a crash 
report in debug builds.

https://cr.openjdk.java.net/~stefank/8246405/webrev.01/
https://bugs.openjdk.java.net/browse/JDK-8246405

I've split out a patch where ZGC uses this functionality:

https://cr.openjdk.java.net/~stefank/8246406/webrev.01/
https://bugs.openjdk.java.net/browse/JDK-8246406

Tested manually by running:
(ulimit -v >low value>; ../build/fastdebug/jdk/bin/java -XX:+UseZGC 
-Xmx18m -Xlog:gc* -version)

and verified that it generates a hs_err file with the appropriate 
information.

On macOS the output points to the right file and line number:

#  Internal Error (src/hotspot/share/gc/z/zVirtualMemory.cpp:46), 
pid=67695, tid=8451
#  Error: Failed to reserve enough address space for Java heap

but since TOUCH_ASSERT_POISON isn't implemented we don't get registers 
and the output contains the GCLogPrecious code:

V  [libjvm.dylib+0xb3d95c]  VMError::report_and_die(int, char const*, 
char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char 
const*, int, unsigned long)+0x670
V  [libjvm.dylib+0xb3e083]  VMError::report_and_die(Thread*, void*, char 
const*, int, char const*, char const*, __va_list_tag*)+0x47
V  [libjvm.dylib+0x334b48]  report_vm_error(char const*, int, char 
const*, char const*, ...)+0x145
V  [libjvm.dylib+0x48d629] 
GCLogPrecious::vwrite_and_debug(LogTargetHandle, char const*, 
__va_list_tag*, char const*, int)+0x81
V  [libjvm.dylib+0xbbdf70] GCLogPreciousHandle::write_and_debug(char 
const*, ...)+0x92
V  [libjvm.dylib+0xbd833e] 
ZVirtualMemoryManager::ZVirtualMemoryManager(unsigned long)+0xb6

On Linux, where TOUCH_ASSERT_POISON is implemented, we get the last 
parts cut away:

V  [libjvm.so+0x1857179] 
ZVirtualMemoryManager::ZVirtualMemoryManager(unsigned long)+0x79
V  [libjvm.so+0x182f84e]  ZPageAllocator::ZPageAllocator(ZWorkers*, 
unsigned long, unsigned long, unsigned long, unsigned long)+0x6e
V  [libjvm.so+0x1808b61]  ZHeap::ZHeap()+0x81
V  [libjvm.so+0x1802559]  ZCollectedHeap::ZCollectedHeap()+0x49

Thanks,
StefanK



More information about the hotspot-gc-dev mailing list