JDK-8153270 : SIGSEGV in stack walking with Sun Studio Performance Analyzer
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2016-04-01
  • Updated: 2022-02-15
  • Resolved: 2022-02-15
Related Reports
Blocks :  
Relates :  
Relates :  
Description
I've recently tried to profile a Java application with the Sun Studio Performance Analyzer on a solaris_x86 machine. The command line I've used was

collect -j on java -Xcomp <app>

Profiling failed due to a segmentation fault in what seems to be caused by stack walking:

# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xffff80ff4939ec65, pid=7477, tid=2
# 

Stack: [0xffff80ffbed4f000,0xffff80ffbee4f000], sp=0xffff80ffbee47b28, free space=994k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C 0xffff80ff4939ec65
V [libjvm.so+0x1cda89f] int Method::bci_from(unsigned char*)const+0x7f
V [libjvm.so+0x1cda9a3] int Method::validate_bci_from_bcp(unsigned char*)const+0x63
V [libjvm.so+0x15ab8bc] bool frame::is_interpreted_frame_valid(JavaThread*)const+0xbc
V [libjvm.so+0x15a9efa] bool frame::safe_for_sender(JavaThread*)+0x31a
V [libjvm.so+0x159816a] void forte_fill_call_trace_given_top(JavaThread*,ASGCT_CallTrace*,int,frame)+0x5ba
V [libjvm.so+0x1598b23] AsyncGetCallTrace+0x243
C [libcollector.so+0x30905] __collector_ext_jstack_unwind+0x115
C [libcollector.so+0x3123a] __collector_get_frame_info_walk+0x26a
C [libcollector.so+0x3e4f8] __collector_getUserCtx+0x28
C [libcollector.so+0x1f22c] __collector_ext_profile_handler+0x13c
C [libcollector.so+0x19f3f] collector_sigprof_dispatcher+0x6f
C [libc.so.1+0x122476] __sighndlr+0x6
C [libc.so.1+0x115972] call_user_handler+0x2ce
C [libc.so.1+0x115e1b] sigacthandler+0xdb
C 0xffffffffffffffff
V [libjvm.so+0x1edb3b5] char*ResourceArea::allocate_bytes(unsigned long,AllocFailStrategy::AllocFailEnum)+0x185
V [libjvm.so+0x1d51242] void nmethod::check_all_dependencies(DepChange&)+0x362
V [libjvm.so+0x13a242f] int CodeCache::mark_for_deoptimization(KlassDepChange&)+0x10f
V [libjvm.so+0x13a324a] void CodeCache::flush_dependents_on(instanceKlassHandle)+0x6a
V [libjvm.so+0x1fff88f] void SystemDictionary::add_to_hierarchy(instanceKlassHandle,Thread*)+0x6f
V [libjvm.so+0x1ffc070] Klass*SystemDictionary::parse_stream(Symbol*,Handle,Handle,ClassFileStream*,const Klass*,GrowableArray<Handle>*,Thread*)+0x390
V [libjvm.so+0x20a11fc] instanceKlassHandle Unsafe_DefineAnonymousClass_impl(JNIEnv_*,_jclass*,_jbyteArray*,_jobjectArray*,unsigned char**,Thread*)+0x84c
V [libjvm.so+0x20a179c] Unsafe_DefineAnonymousClass0+0x1fc
J 1952 java.base@9-internal9-internal (0 bytes) @ 0xffff80ff982f3f31 [0xffff80ff982f3dc0+0x0000000000000171]
J 2046 C1 java.base@9-internal9-internal (103 bytes) @ 0xffff80ff91432924 [0xffff80ff91432240+0x00000000000006e4]
J 2097 C1 java.base@9-internal9-internal (106 bytes) @ 0xffff80ff9146de74 [0xffff80ff9146dde0+0x0000000000000094]
J 2048 C2 java.base@9-internal9-internal (37 bytes) @ 0xffff80ff982fe294 [0xffff80ff982fdf40+0x0000000000000354]
J 2096 C1 java.base@9-internal9-internal (32 bytes) @ 0xffff80ff9146d88c [0xffff80ff9146d820+0x000000000000006c]
J 2893 C2 java.base@9-internal9-internal (84 bytes) @ 0xffff80ff983809e4 [0xffff80ff983809a0+0x0000000000000044]
j java.lang.invoke.BoundMethodHandle$Species_L13.make(Ljava/lang/invoke/MethodType;Ljava/lang/invoke/LambdaForm;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;\
Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/invoke/BoundMethodHandle;
[error occurred during error reporting (printing native stack), id 0xb]

The problem is reproducable roughly once in 100 runs.


Comments
<S12Y triage team>: Solaris not supported
15-02-2022

FYI, I'm seeing a very similar crash and stacktrace while using async-profiler on SpecJVM2008 sunflow on JDK8 (1.8.0_281). Stack: [0x00007fb6aebec000,0x00007fb6aeced000], sp=0x00007fb6aecea310, free space=1016k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x5a4753] frame::is_interpreted_frame_valid(JavaThread*) const+0x43 V [libjvm.so+0x21d10a] forte_fill_call_trace_given_top(JavaThread*, ASGCT_CallTrace*, int, frame) [clone .isra.12]+0x1b4 V [libjvm.so+0x59904f] AsyncGetCallTrace+0x1af C [libasyncProfiler.so+0x22561] Profiler::getJavaTraceAsync(void*, ASGCT_CallFrame*, int)+0x561 C [libasyncProfiler.so+0x22858] Profiler::recordSample(void*, unsigned long long, int, _jmethodID*, ThreadState)+0x1f8 C [libasyncProfiler.so+0x1f86a] PerfEvents::signalHandler(int, siginfo*, void*)+0x7a C [libpthread.so.0+0x12b40] j org.sunflow.core.accel.KDTree.build(Lorg/sunflow/core/PrimitiveList;)V+521 j org.sunflow.core.Geometry.build()V+72 j org.sunflow.core.Geometry.intersect(Lorg/sunflow/core/Ray;Lorg/sunflow/core/IntersectionState;)V+19 j org.sunflow.core.Instance.intersect(Lorg/sunflow/core/Ray;Lorg/sunflow/core/IntersectionState;)V+20 j org.sunflow.core.InstanceList.intersectPrimitive(Lorg/sunflow/core/Ray;ILorg/sunflow/core/IntersectionState;)V+8 j org.sunflow.core.accel.BoundingIntervalHierarchy.intersect(Lorg/sunflow/core/Ray;Lorg/sunflow/core/IntersectionState;)V+1183 j org.sunflow.core.Scene.trace(Lorg/sunflow/core/Ray;Lorg/sunflow/core/IntersectionState;)V+50 j org.sunflow.core.LightServer$1.run()V+301 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [libjvm.so+0x6b09fd] JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*)+0xc5d V [libjvm.so+0x6ae353] JavaCalls::call_virtual(JavaValue*, KlassHandle, Symbol*, Symbol*, JavaCallArguments*, Thread*)+0x263 V [libjvm.so+0x6ae91f] JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Thread*)+0x4f V [libjvm.so+0x71d24c] thread_entry(JavaThread*, Thread*)+0x6c V [libjvm.so+0xb4a3e4] JavaThread::thread_main_inner()+0xc4 V [libjvm.so+0xb4a6e1] JavaThread::run()+0x2d1 V [libjvm.so+0x9d7312] java_start(Thread*)+0x102 C [libpthread.so.0+0x816a]
02-03-2021

I'm not working on this bug now.
23-01-2019

ILW=M(crash)M(intermittent)H(no workaround)=P3
05-04-2016

Here are two stack traces (hs_err file also attached) that were obtained with an unmodified b112 build: Stack: [0xffff80ffbeb3f000,0xffff80ffbec3f000], sp=0xffff80ffbec3b360, free space=1008k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [libcollector.so+0x33d0b] find_i386_ret_addr+0x13db C [libcollector.so+0x31409] __collector_get_frame_info_walk+0x439 C [libcollector.so+0x3e4f8] __collector_getUserCtx+0x28 C [libcollector.so+0x1f22c] __collector_ext_profile_handler+0x13c C [libcollector.so+0x19f3f] collector_sigprof_dispatcher+0x6f C [libc.so.1+0x122476] __sighndlr+0x6 C [libc.so.1+0x115972] call_user_handler+0x2ce C [libc.so.1+0x115e1b] sigacthandler+0xdb C 0xffffffffffffffff J 2947% C2 LongLambdaFormDynamicStackDepth.test()V (196 bytes) @ 0xffff80ffa7799660 [0xffff80ffa77994e0+0x0000000000000180] J 2675 C1 LongLambdaFormDynamicStackDepth.main([Ljava/lang/String;)V (31 bytes) @ 0xffff80ffa0a964f4 [0xffff80ffa0a96220+0x00000000000002d4] v ~StubRoutines::call_stub V [libjvm.so+0x17cdfd2] void JavaCalls::call_helper(JavaValue*,const methodHandle&,JavaCallArguments*,Thread*)+0x392 V [libjvm.so+0x18807d1] void jni_invoke_static(JNIEnv_*,JavaValue*,_jobject*,JNICallType,_jmethodID*,JNI_ArgumentPusher*,Thread*)+0x2a1 V [libjvm.so+0x18aac76] jni_CallStaticVoidMethod+0x3e6 C [libjli.so+0x6da7] JavaMain+0x2f7 C [libc.so.1+0x122105] _thrp_setup+0xa5 C [libc.so.1+0x1223b0] _lwp_start+0x0 Stack: [0xffff80ffbeb3f000,0xffff80ffbec3f000], sp=0xffff80ffbec3b110, free space=1008k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [libcollector.so+0x33d0b] find_i386_ret_addr+0x13db C [libcollector.so+0x31409] __collector_get_frame_info_walk+0x439 C [libcollector.so+0x3e4f8] __collector_getUserCtx+0x28 C [libcollector.so+0x1f22c] __collector_ext_profile_handler+0x13c C [libcollector.so+0x19f3f] collector_sigprof_dispatcher+0x6f C [libc.so.1+0x122476] __sighndlr+0x6 C [libc.so.1+0x115972] call_user_handler+0x2ce C [libc.so.1+0x115e1b] sigacthandler+0xdb C 0xffffffffffffffff J 1409 C1 java.base@9-ea9-ea (93 bytes) @ 0xffff80ffa05cdab4 [0xffff80ffa05cd8a0+0x0000000000000214] J 1407 C1 java.base@9-ea9-ea (4 bytes) @ 0xffff80ffa05cd264 [0xffff80ffa05cd220+0x0000000000000044] v ~StubRoutines::call_stub V [libjvm.so+0x17cdfd2] void JavaCalls::call_helper(JavaValue*,const methodHandle&,JavaCallArguments*,Thread*)+0x392 V [libjvm.so+0x17cd7f1] void JavaCalls::call_static(JavaValue*,KlassHandle,Symbol*,Symbol*,JavaCallArguments*,Thread*)+0x171 V [libjvm.so+0x17cd8e4] void JavaCalls::call_static(JavaValue*,KlassHandle,Symbol*,Symbol*,Thread*)+0x84 V [libjvm.so+0x2043165] void call_postVMInitHook(Thread*)+0x95 V [libjvm.so+0x204fc4f] int Threads::create_vm(JavaVMInitArgs*,bool*)+0x88f V [libjvm.so+0x18d50df] int JNI_CreateJavaVM_inner(JavaVM_**,void**,void*)+0x7f V [libjvm.so+0x18d55d9] JNI_CreateJavaVM+0x9 C [libjli.so+0x959b] InitializeJVM+0x11b C [libjli.so+0x6b05] JavaMain+0x55 C [libc.so.1+0x122105] _thrp_setup+0xa5 C [libc.so.1+0x1223b0] _lwp_start+0x0
04-04-2016

Moving from hotspot/runtime -> hotspot/svc. The Serviceability team owns AsyncGetCallTrace().
01-04-2016