While working on some stack walking code, I happened
to notice that the VMError::print_native_stack() function
is missing an os::is_first_C_frame() call before one of the
os::get_sender_for_C_frame() calls.
Because of this omission, an hs_err_pid file will sometimes
show a stack like this:
--------------- T H R E A D ---------------
Current thread (0x00007f83f3801800): JavaThread "main" [_thread_in_vm, id=4099, stack(0x000000010aea3000,0x000000010afa3000)]
Stack: [0x000000010aea3000,0x000000010afa3000], sp=0x000000010afa2950, free space=1022k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.dylib+0x116ec55] crash_with_segfault()+0x15
V [libjvm.dylib+0x116c96d] VMError::controlled_crash(int)+0x56d
V [libjvm.dylib+0x116ec37] VMError::test_error_handler()+0x17
V [libjvm.dylib+0xad41ba] JNI_CreateJavaVM_inner(JavaVM_**, void**, void*)+0x39a
V [libjvm.dylib+0xad3e0c] JNI_CreateJavaVM+0x2c
C [java+0x6ac8] InitializeJVM+0x138
C [java+0x5c3c] JavaMain+0xac
C [libsystem_pthread.dylib+0x405a] _pthread_body+0x83
C [libsystem_pthread.dylib+0x3fd7] _pthread_body+0x0
C [libsystem_pthread.dylib+0x13ed] thread_start+0xd
[error occurred during error reporting (printing native stack), id 0xb]
siginfo: ...
when it should show a stack like this:
--------------- T H R E A D ---------------
Current thread (0x00007f8ca2005000): JavaThread "main" [_thread_in_vm, id=4099, stack(0x00000001059d0000,0x0000000105ad0000)]
Stack: [0x00000001059d0000,0x0000000105ad0000], sp=0x0000000105acf950, free space=1022k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.dylib+0x116ec55] crash_with_segfault()+0x15
V [libjvm.dylib+0x116c96d] VMError::controlled_crash(int)+0x56d
V [libjvm.dylib+0x116ec37] VMError::test_error_handler()+0x17
V [libjvm.dylib+0xad41ba] JNI_CreateJavaVM_inner(JavaVM_**, void**, void*)+0x39a
V [libjvm.dylib+0xad3e0c] JNI_CreateJavaVM+0x2c
C [java+0x6ac8] InitializeJVM+0x138
C [java+0x5c3c] JavaMain+0xac
C [libsystem_pthread.dylib+0x405a] _pthread_body+0x83
C [libsystem_pthread.dylib+0x3fd7] _pthread_body+0x0
C [libsystem_pthread.dylib+0x13ed] thread_start+0xd
siginfo: ....
The "[error occurred during error reporting (printing native stack), id 0xb]"
line shouldn't be there and if VMError::print_native_stack() is called
outside of the error handler context, then you would see that the
"error occurred during error reporting" is an assertion failure:
frame #16: 0x000000010af69c0e libjvm.dylib`frame::init(this=0x000000012d876f20, sp=0x000000012d879f88, fp=0x0000000000000000, pc=0x0000000000000000) + 142 at frame_x86.inline.hpp:49
46 _unextended_sp = sp;
47 _fp = fp;
48 _pc = pc;
-> 49 assert(pc != NULL, "no pc?");
to notice that the VMError::print_native_stack() function
is missing an os::is_first_C_frame() call before one of the
os::get_sender_for_C_frame() calls.
Because of this omission, an hs_err_pid file will sometimes
show a stack like this:
--------------- T H R E A D ---------------
Current thread (0x00007f83f3801800): JavaThread "main" [_thread_in_vm, id=4099, stack(0x000000010aea3000,0x000000010afa3000)]
Stack: [0x000000010aea3000,0x000000010afa3000], sp=0x000000010afa2950, free space=1022k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.dylib+0x116ec55] crash_with_segfault()+0x15
V [libjvm.dylib+0x116c96d] VMError::controlled_crash(int)+0x56d
V [libjvm.dylib+0x116ec37] VMError::test_error_handler()+0x17
V [libjvm.dylib+0xad41ba] JNI_CreateJavaVM_inner(JavaVM_**, void**, void*)+0x39a
V [libjvm.dylib+0xad3e0c] JNI_CreateJavaVM+0x2c
C [java+0x6ac8] InitializeJVM+0x138
C [java+0x5c3c] JavaMain+0xac
C [libsystem_pthread.dylib+0x405a] _pthread_body+0x83
C [libsystem_pthread.dylib+0x3fd7] _pthread_body+0x0
C [libsystem_pthread.dylib+0x13ed] thread_start+0xd
[error occurred during error reporting (printing native stack), id 0xb]
siginfo: ...
when it should show a stack like this:
--------------- T H R E A D ---------------
Current thread (0x00007f8ca2005000): JavaThread "main" [_thread_in_vm, id=4099, stack(0x00000001059d0000,0x0000000105ad0000)]
Stack: [0x00000001059d0000,0x0000000105ad0000], sp=0x0000000105acf950, free space=1022k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.dylib+0x116ec55] crash_with_segfault()+0x15
V [libjvm.dylib+0x116c96d] VMError::controlled_crash(int)+0x56d
V [libjvm.dylib+0x116ec37] VMError::test_error_handler()+0x17
V [libjvm.dylib+0xad41ba] JNI_CreateJavaVM_inner(JavaVM_**, void**, void*)+0x39a
V [libjvm.dylib+0xad3e0c] JNI_CreateJavaVM+0x2c
C [java+0x6ac8] InitializeJVM+0x138
C [java+0x5c3c] JavaMain+0xac
C [libsystem_pthread.dylib+0x405a] _pthread_body+0x83
C [libsystem_pthread.dylib+0x3fd7] _pthread_body+0x0
C [libsystem_pthread.dylib+0x13ed] thread_start+0xd
siginfo: ....
The "[error occurred during error reporting (printing native stack), id 0xb]"
line shouldn't be there and if VMError::print_native_stack() is called
outside of the error handler context, then you would see that the
"error occurred during error reporting" is an assertion failure:
frame #16: 0x000000010af69c0e libjvm.dylib`frame::init(this=0x000000012d876f20, sp=0x000000012d879f88, fp=0x0000000000000000, pc=0x0000000000000000) + 142 at frame_x86.inline.hpp:49
46 _unextended_sp = sp;
47 _fp = fp;
48 _pc = pc;
-> 49 assert(pc != NULL, "no pc?");
- relates to
-
JDK-8035983 Fix "Native frames:" in crash report (hs_err file)
-
- Closed
-