AdoptOpenJDK / jitwatch

Log analyser / visualiser for Java HotSpot JIT compiler. Inspect inlining decisions, hot methods, bytecode, and assembly. View results in the JavaFX user interface.
Other
3.06k stars 437 forks source link

JITWatch hangs during parsing #298

Closed ajayborra closed 5 years ago

ajayborra commented 5 years ago

Hi @chriswhocodes

JITWatch hangs during the parsing phase while analyzing the logs, Need you help on this. Following are the details of my setup.

OS: Ubuntu 16.04.6 LTS JVM: OpenJDK 64-Bit Server VM (25.191-b12, mixed mode) Java: version 1.8.0_191, vendor Oracle Corporation

Got ~136k class files loaded for analysis. Following image provides more details on Memory/CPU usage. 1

Also, Seems like threads are hanging on null address from the thread dump taken after the hang. Check the following image for waiting on condition [0x0000000000000000] 2

chriswhocodes commented 5 years ago

Hi @ajayborra how big is the HotSpot log file you are trying to load? Were any messages printed to the console? Could you look in the jitwatch.out logfile and paste the last 100 lines here please? Thanks, Chris

ajayborra commented 5 years ago

HotSpot log file is ~950MB, Following is the list of unique exceptions that were printed in the jitwatch.out file in same order

[Thread-6] ERROR o.a.j.p.AbstractLogParser - Could not addClassToModel <<class name> > java.lang.SecurityException: class <<class name>> signer information does not match signer information of other classes in the same package
ERROR o.a.j.m.JITDataModel - Something unexpected happened building meta class org.osgi.service.log.admin.LoggerContext
WARN  o.a.j.m.JITDataModel - NoClassDefFoundError: <<class path>> while building class <<package name>>
chriswhocodes commented 5 years ago

Wow, that's a big log file! I've only tested with up to around 100MB. My initial thoughts are that it's stalling one of the JavaFX components, probably the TextArea in the main window where it logs each queued event and compilation.

Please could you try commenting out two append statements here (lines 151 and 1516)

private void log(final String entry)
{
    logBuffer.append(entry);
    logBuffer.append(S_NEWLINE);
}

in file ui/src/main/java/org/adoptopenjdk/jitwatch/ui/main/JITWatchUI.java and re-compiling JITWatch to see if that helps?

ajayborra commented 5 years ago

Redirected the output to terminal instead of appending to the javaFX component so that we can look at what is the progress. Parsing still hangs at similar point. Do we have a way to enable debug logging ?

Also, Tried increased the memory limits with the following parameters -XX:ReservedCodeCacheSize=2G -XX:MetaspaceSize=2G -XX:MaxMetaspaceSize=2G -XX:MinMetaspaceFreeRatio=40 -XX:MaxMetaspaceFreeRatio=40

chriswhocodes commented 5 years ago

Yes you can enable detailed logging by editing core/src/main/resources/logback.xml and changing

<root level="INFO">          
    <appender-ref ref="STDOUT" />
    <appender-ref ref="FILE" />
  </root>  

to be

<root level="DEBUG">
<appender-ref ref="STDOUT" />
    <appender-ref ref="FILE" />
  </root> 

the output will be jitwatch.out

ajayborra commented 5 years ago

Haven't got many logs from debug mode. May have to add more debug logs or probably debug the parsing phase looks like!

ajayborra commented 5 years ago

Found the following flags to enable more debug log https://github.com/AdoptOpenJDK/jitwatch/blob/master/core/src/main/java/org/adoptopenjdk/jitwatch/core/JITWatchConstants.java#L22-L35. Will share the findings.

ajayborra commented 5 years ago

Hi @chriswhocodes, Further debugging indicated that parsing thread is killed due to an uncaught exception and later it hangs. Was able to fix the issue and get it running with the following fix https://github.com/AdoptOpenJDK/jitwatch/pull/300 We can go ahead and close this issue. Thanks for your help and awesome tool 👍