@@ -584,26 +584,34 @@ public void processTraces() throws IOException {
584584 processActivationEventsUpTo (stackTrace .nanoTime , eof , event );
585585 CallTree .Root root = profiledThreads .get (stackTrace .threadId );
586586 if (root != null ) {
587- jfrParser .resolveStackTrace (stackTrace .stackTraceId , stackFrames , MAX_STACK_DEPTH );
588- if (stackFrames .size () == MAX_STACK_DEPTH ) {
589- logger .fine (
590- "Max stack depth reached. Set profiling_included_classes or profiling_excluded_classes." );
591- }
592- // stack frames may not contain any Java frames
593- // see
594- // https://github.com/jvm-profiling-tools/async-profiler/issues/271#issuecomment-582430233
595- if (!stackFrames .isEmpty ()) {
596- try {
597- root .addStackTrace (
598- stackFrames , stackTrace .nanoTime , callTreePool , inferredSpansMinDuration );
599- } catch (Throwable e ) {
600- logger .log (
601- Level .WARNING ,
602- "Removing call tree for thread {0} because of exception while adding a stack trace: {1} {2}" ,
603- new Object [] {stackTrace .threadId , e .getClass (), e .getMessage ()});
604- logger .log (Level .FINE , e .getMessage (), e );
605- profiledThreads .remove (stackTrace .threadId );
587+ try {
588+ jfrParser .resolveStackTrace (stackTrace .stackTraceId , stackFrames , MAX_STACK_DEPTH );
589+ if (stackFrames .size () == MAX_STACK_DEPTH ) {
590+ logger .fine (
591+ "Max stack depth reached. Set profiling_included_classes or profiling_excluded_classes." );
592+ }
593+ // stack frames may not contain any Java frames
594+ // see
595+ // https://github.com/jvm-profiling-tools/async-profiler/issues/271#issuecomment-582430233
596+ if (!stackFrames .isEmpty ()) {
597+ try {
598+ root .addStackTrace (
599+ stackFrames , stackTrace .nanoTime , callTreePool , inferredSpansMinDuration );
600+ } catch (Throwable e ) {
601+ logger .log (
602+ Level .WARNING ,
603+ "Removing call tree for thread {0} because of exception while adding a stack trace: {1} {2}" ,
604+ new Object [] {stackTrace .threadId , e .getClass (), e .getMessage ()});
605+ logger .log (Level .FINE , e .getMessage (), e );
606+ profiledThreads .remove (stackTrace .threadId );
607+ }
606608 }
609+ } catch (Throwable e ) {
610+ logger .log (
611+ Level .WARNING ,
612+ "Failed to resolve stack trace for thread {0}: {1}" ,
613+ new Object [] {stackTrace .threadId , e .getMessage ()});
614+ logger .log (Level .FINE , e .getMessage (), e );
607615 }
608616 }
609617 stackFrames .clear ();
0 commit comments