Debug JVM crashes on the following assertion if CPU and Wall clock profiling modes are enabled together. It may also crash if two profiler instances are running simultaneously.
# assert(!thread->in_asgct()) failed: invariant
Stack: [0x00007fcc35fe4000,0x00007fcc360e5000], sp=0x00007fcc360e0230, free space=1008k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0xc5cd51] AsyncGetCallTrace+0x261
C [libasyncProfiler.so+0x16775] Profiler::getJavaTraceAsync(void*, ASGCT_CallFrame*, int, StackContext*)+0xb5
C [libasyncProfiler.so+0x24927] Profiler::recordSample(void*, unsigned long long, EventType, Event*)+0x837
C [libasyncProfiler.so+0x256d8] PerfEvents::signalHandler(int, siginfo_t*, void*)+0xd8
C [libpthread.so.0+0x118e0]
V [libjvm.so+0xc6b5c7] frame::frame(long*, long*, long*, unsigned char*)+0x47
V [libjvm.so+0xc693cc] frame::safe_for_sender(JavaThread*)+0x46c
V [libjvm.so+0xc5bb7c] vframeStreamForte::forte_next()+0x5c
V [libjvm.so+0xc5c369] forte_fill_call_trace_given_top(JavaThread*, ASGCT_CallTrace*, int, frame)+0x3f9
V [libjvm.so+0xc5cd9e] AsyncGetCallTrace+0x2ae
C [libasyncProfiler.so+0x16775] Profiler::getJavaTraceAsync(void*, ASGCT_CallFrame*, int, StackContext*)+0xb5
C [libasyncProfiler.so+0x24927] Profiler::recordSample(void*, unsigned long long, EventType, Event*)+0x837
C [libasyncProfiler.so+0x25772] WallClock::signalHandler(int, siginfo_t*, void*)+0x42
This is a regression that appeared after JDK-8304725 which added the above assertion thus making AsyncGetCallTrace no longer reentrant. However, there is nothing in AGCT implementation besides this assertion that prevents it from being reentrant.
There were no issues when running multi-mode profiling with product JVM builds.