uber-common / jvm-profiler

JVM Profiler Sending Metrics to Kafka, Console Output or Custom Reporter
Other
1.79k stars 342 forks source link

AssertionError: Malformated json. 'stacktrace' key doesn't exist. #35

Closed cchung100m closed 5 years ago

cchung100m commented 5 years ago

Hi @viirya ,

Sorry for any inconvenience.

I am trying to run Spark in the local mode, along with the JVM profiler, however, I encounter some issue when trying to generate flamegraph of Stacktrack Profiling result. I would appreciate if you can provide some suggestions, thank you.

Best regards,

Run Spark along with the JVM profiler: cch:target cch$ spark-submit --class com.github.ehiggs.spark.terasort.TeraSort --conf "spark.driver.extraJavaOptions=-javaagent:/Users/cch/eclipse-workspace/jvm-profiler/target/jvm-profiler-1.0.0.jar=reporter=com.uber.profiling.reporters.FileOutputReporter,ioProfiling=true,outputDir=/Users/cch/Downloads/Stacktrace.json" --conf "spark.executor.extraJavaOptions=-javaagent:/Users/cch/eclipse-workspace/jvm-profiler/target/jvm-profiler-1.0.0.jar=reporter=com.uber.profiling.reporters.FileOutputReporter,ioProfiling=true,outputDir=/Users/cch/Downloads/Stacktrace.json" /Users/cch/eclipse-workspace/spark-terasort/target/spark-terasort-1.1-SNAPSHOT-jar-with-dependencies.jar /Users/cch/Downloads/terasort_in /Users/cch/Downloads/terasort_out

Generate flamegraph of Stacktrack Profiling result:

cch:target cch$ python /Users/cch/eclipse-workspace/jvm-profiler/stackcollapse.py -i /Users/cch/Downloads/Stacktrace.json/CpuAndMemory.json > /Users/cch/Downloads/StacktraceOut/CpuAndMemory.folded
Traceback (most recent call last):
  File "/Users/cch/eclipse-workspace/jvm-profiler/stackcollapse.py", line 17, in <module>
    assert 'stacktrace' in stacktraceLog, "Malformated json. 'stacktrace' key doesn't exist."
AssertionError: Malformated json. 'stacktrace' key doesn't exist.

Stacktrace.zip

viirya commented 5 years ago

Thanks for the ping. I will take a look at this.

viirya commented 5 years ago

Hi @cchung100m Looks like you didn't set sampleInterval parameter? If this value is not set or zero, the profiler will not do stacktrace sampling. Can you set it and re-try?

cchung100m commented 5 years ago

Hi @viirya

Thank you for the prompt reply.

I get the flame graph after setting the parameter 'sampleInterval'.

Thank you for the suggestions.

Stacktrace.svg.zip

felixcheung commented 5 years ago

thanks! @viirya

btw, should we clarify this in documentation?

viirya commented 5 years ago

@felixcheung ok. I will make a small PR to add it to the document.