Try Chronon Debugger with IntelliJ IDEA 13.1 EAP

Exciting news! The upcoming IntelliJ IDEA 13.1 will bring you integration with Chronon Debugger (via this plugin). You can try it right away with the latest preview build. In case you’re wondering, Chronon is a new revolutionary tool keeping track of running Java programs and recording their execution process for later analysis, which can be helpful when you need to thoroughly retrace your steps when dealing with complicated bugs.

Chronon is a commercial tool and normally you would need to buy a license to use it, but the awesome news for you is that it’s completely free to use with IntelliJ IDEA 13.1 Ultimate.

In this post I will give you a quick intro into how Chronon works and how you can use it with IntelliJ IDEA 13.1 EAP.

Install Plugin

To enable Chronon, you need to go to SettingsPluginsInstall JetBrains plugin, select Chronon, and click Install plugin.

chronon_install_1

Chronon Include/Exclude Patterns

Chronon uses code instrumentation to record the data, so we need to tell it which classes it should look at. For that, open the run configuration that you’re using for your application and specify Include / Exclude Patterns on the Chronon tab. Choose the classes carefully, because tracking too many of them at the same time would have significant negative performance impact.

chronon_run_configuration

Let’s see how Chronon works on a simple example of the two-threaded array sorting, where one thread performs quicksort, and the other one does bubble sorting. It’s essential to understand that Chronon is not literally a debugger, as it only helps you record the execution progress and then,  play it back, like a videotape.

Run with Chronon

Well, it’s time to run our app. For that we can either click the toolbar button or use the RunRun ‘ChrononDemo’ with Chronon menu.

chronon_1

When the app finishes, IntelliJ IDEA unpacks the recording data and opens the Chronon tool window (which looks very similar that of Debugger.) Of course, you can open a previously recorded session and play it back via the RunOpen Chronon Recording action in the main menu.

 chronon_3

Debug actions

Here we can step through the recorded data forward or backward by using the actions from the Run menu.

chronon_menu_2

Variable history

As the current position changes, the Locals tab displays values of local variables. If you select a local variable, the History tab displays the entire history of changes made to that variable during the recorded runtime. Note that the variables data is only shown for the primitives types and the classes specified in the Include Pattern.

chronon_4

Double-clicking a change in the History tab will take you to the code where it has occurred.

chronon_5

History of changes is available for elements of local arrays and collections as well.

chronon_6

Switch between threads

The Threads tab lets you switch between different threads that have been recorded.

chronon_threads_1

Method history

One of the tabs in the Chronon tool window is the Method history. In it you can track the execution history of a method, with the input and output data, which makes it easy to see how and where a method has been invoked.

chronon_method_history

Logging

The Logging tab lets you define custom logging statements and track their output during the program execution.

chronon_logging_1

Exceptions

Chronon is especially helpful when debugging failed tests. The Exceptions tab displays all recorded exceptions and you can double-click them to see a playback of how and when they occurred.

chronon_error_1

By the way, this is exactly what we’re doing to investigate problems that are otherwise very hard to reproduce when tests fail on our Teamcity build server. TeamCity uses Chronon to run tests so we can use its recordings at any time to examine problems and spot bugs.

We hope you’ll find Chronon helpful, and as always, are waiting for your feedback in our discussion forum and issue tracker.

Develop with Pleasure!

About Andrey Cheptsov

Andrey Cheptsov is IntelliJ IDEA product marketing manager at JetBrains. He's passionate about productivity, programming languages and tools.
This entry was posted in New Features and tagged , , . Bookmark the permalink.

38 Responses to Try Chronon Debugger with IntelliJ IDEA 13.1 EAP

  1. Florin Patan says:

    This looks very cool! Congrats.

    I wonder if the API will be open so that we could integrate the value history (and maybe method history) as I’m a plugin developer and the plugin I’m working on also includes a debugger (GDB to use for golang).

    Thanks.

  2. Sarah Kho says:

    How does this debugger compare with the built-in debugger? Aka, what features this debugger provides that are not available in the default debugger (for a java/ee developer)?

    Thanks.

    • Andrey Cheptsov says:

      As the article says Chronon is not literally a debugger. It only helps you record the execution progress and then, play it back, like a videotape. However we’d like to see Chronon UX similar to the UX of the built-in debugger as the use-cases have a lot in common (stepping back and forward, stopping at a breakpoint, evaluating an expression, etc). That’s why we ask you to give it a try and share your feedback.

  3. Hans G. says:

    This simply looks incredible.

    Any chance to extend this kind of functionality to web applications too? e.g. JSP support, etc.

  4. Jason King says:

    This looks very useful. Will scala projects be supported?

  5. macdevign says:

    Trying Chronon but it keep throwing this error. I using Mac mavericks and running latest intellij and java 8.

    Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseSplitVerifier; support was removed in 8.0
    objc[18778]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
    java.lang.IllegalArgumentException
    at java.com.chronon3.sb.recorder.custom.org.objectweb.asm.ClassReader.(SourceFile:170)
    at java.com.chronon3.sb.recorder.custom.org.objectweb.asm.ClassReader.(SourceFile:153)
    at java.com.chronon3.sb.recorder.instrumentors.a.e.a(SourceFile:21)
    at java.com.chronon3.sb.recorder.instrumentors.a.a.b.a(SourceFile:61)
    at java.com.chronon3.sb.recorder.instrumentors.a.a.a.transform(SourceFile:53)
    at sun.instrument.TransformerManager.transform(TransformerManager.java:188)

    Any idea what is wrong ?

    • Prashant says:

      jdk 8 is currently not supported due to the split verifier issue (and also because it is not officially released yet).
      please use jdk 6 or 7.

  6. Charles says:

    Does the Chronon Intellij plugin work for remote applications? I’ve installed the plugin, but the Chronon tab is only available for Application run/debug configurations, not Remote.

  7. Evgen Temchenko says:

    It’s awesome!

    But I faced with one major issue – I am unable to add classes and packages from JDK.

    E.g. I’ve added “java.util.*” into Include pattern column but it doesn’t show the values of the variables from that package.

    The same issue with adding particular class from jdk – java.util.Date.

    Do you know anything about that? Am I doing something wrong?

  8. Ron says:

    I just quickly wanted to test it with a static main method:
    int i = 3;
    i *= 2;
    sout(i);

    The program runs with these logs:
    Chronon: Shutting down…
    Chronon: Please wait while runtime date is processed…
    Chronon: Compressing Data …
    Chronon: Saving to disk …
    Chronon: Done

    But I’m getting an error message saying
    “Error unpacking recording: null”
    Why?

    IntelliJ 13.1 ultimate, Java 1.7 (51)

  9. Ron says:

    Hi Egor, thank you for your reply. With log, do you mean the Run window (Alt + 4)? There is no exception listed, just the Chronon results mentioned above.
    I tested the same project on Win7 and it works. Could it be possible that the plugin has issues with Win8.1 (64bit)?

  10. Kevin says:

    This make me want to cry (for joy)

  11. Espen says:

    Thought I would give this a try. It looked awesome, and I love my IntelliJ IDEA. I have a web application I wanted to test this on, so I installed the Chronon Recording Server and sat that up to collect recordings from my Jetty installation. It worked just fine. Then I downloaded the recording to my laptop (it was a tar so I had to untar it first) and then tried to open it with the “Open Chronon recording…” dialog in IntelliJ. but alas, it only says “Chronon Recording not found”.

    Can I only with the Chronon Plugin open recordings done by the plugin itself?

    • Egor says:

      In this case you need to unpack the recording manually and then open the unpacked folder (though it will not have the chronon icon)

    • Egor says:

      Another way is to create a folder structure IDEA is expecting:
      top folder named as you wish and subfolder “recording” with the actual recording.
      In this case IDEA will open the top folder, unpack the recording into “unpackedRecording” subfolder and open it.

  12. kode says:

    I just upgraded to IDEA 13.1. I was playing around with the new Chronon debugger when I noticed that when I stop a Java application that was launched using the “Run with Chronon” feature, I got the following error message:

    Chronon Recording Not Found

    And the error popup includes the path where it’s trying to look for the file.

    I’m on OS X Mavericks 10.9.2, IDEA 13.1, JDK 1.6.0_65 64 bit.

    What am I missing here?

  13. Per says:

    Really a WOW plugin, I’m impressed.

    But why F8 / Alt-F6 etc to move fwd and backward ? After all, this is not a debugger, but more og a “player”. I think the plugin would become even more useful with arrow keys, or the mouse wheel to go forward/back.

    • Egor says:

      For now we mimic regular debugger “look and feel” just because people are used to it. In future we may rethink what’s the best user interface for such technology. Thanks for your feedback!

  14. Patras Vlad says:

    This is a great concept and I’ve followed it for a while, even before there was IntelliJ integration.
    I tried the plugin and got the same outcome as one year ago. It works great for simple programs, however once you add things like Spring, JMS etc. (not for monitoring, just as part of your application), it becomes unusable. I never got it to work for our application, depending on what I try, it either blocks when instrumenting classes, spring blocks while loading, or it only records the first second or two.
    This happens even when I start unit tests (so no app server or odd JVM configuration involved).

  15. This looks awesome for applications that truly do have a static “main” method, but can it be used with applications outside of that limited range? What about web applications, launched from a servlet container? What about Maven integration?

    I am working on a project that uses GWT and the Google App Engine, and a local development machine run is launched through the “gwt:run” Maven goal. When I edit the “Run/Debug Configuration” entry for this Maven goal, there is no “Chronon” tab to configure.

    However, I *can* launch the Maven goal using the “Run with Chronon” icon in the top toolbar… and the “Run with Chronon” option is present when I right-click on the goal in the Maven Projects view. When execution exits, though, selecting “Run -> Open Chronon Recording” and selecting the project directory produces a “Chronon recording not found” error dialog.

    So is Chronon meant to support recording of Maven-launched executions, or not? Unless I’m missing something, it looks the integration is there but in a half-completed state.

  16. Jyrki says:

    I’m getting “Chronon recording not found in /home/jyrki/.IntelliJIdea13/system/chronon-recordings/2014_03_21_Runner5″. There’s some files there

    tree ~/.IntelliJIdea13/system/chronon-recordings/2014_03_21_Runner5
    /home/jyrki/.IntelliJIdea13/system/chronon-recordings/2014_03_21_Runner5
    |– 2014-03-21-08-18-48-567.date
    |– config.txt
    -- recording
    – 0.rcd

    1 directory, 3 files

    desktop :: ~ » cat ~/.IntelliJIdea13/system/chronon-recordings/2014_03_21_Runner5/config.txt
    dir = /home/jyrki/.IntelliJIdea13/system/chronon-recordings/2014_03_21_Runner5/recording
    include = fi.sysart.**

    </blockquote

  17. Peter Quiel says:

    Running Unittest works and if I start a Java App end use the exit button to stop the app everything works fine as well.

    But starting a Webapp on JBoss I don’t have an exit button end pressing the stop button results in the the “Chronon recording not found” because the recording ist not unpacked when using stop button to shut down the webserver.

    There should be a way to trigger the unpacking manually.

  18. Peter Quiel says:

    Addition:

    Trying to unpack the recording manually ended up in:

    Error: no meta data found
    This means:
    – Your recording has not been finished properly and is corrupt.

  19. Alik says:

    It is very easy to start chronon recording when an app is started from IDEA. How to enable the recording of the app running on a remote server?

    Thank you!

  20. Rob says:

    This looks great but I can’t get my server to run with it. I’m getting an error saying: “recorderagent64-3.0.7.dll is not a valid Win32 application”

    The full output looks like:

    "C:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\AppSrv04\bin\generated_websphere_server_start_script.cmd"
    "C:\Program Files (x86)\IBM\WebSphere\AppServer\java\bin\java" -Dfile.encoding=windows-1252 -classpath "C:\Program Files (x86)\IBM\WebSphere\AppServer\runtimes\com.ibm.ws.admin.client_7.0.0.jar;C:\Program Files (x86)\IBM\WebSphere\AppServer\plugins\com.ibm.ws.security.crypto.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.1\plugins\webSphereIntegration\lib\webSphereIntegration.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.1\plugins\JavaEE\lib\javaee-impl.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.1\lib\openapi.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.1\plugins\webSphereIntegration\lib\specifics\webSphereClientImpl.jar" com.intellij.javaee.oss.process.JavaeeProcess 55991 com.intellij.j2ee.webSphere.agent.WebSphereAgent
    JVMJ9TI001E Agent library C:\Users\MCDIARR\.IntelliJIdea13\config\plugins\chronon\lib\recorder\native\recorderagent64-3.0.7.dll could not be opened (C:\Users\MCDIARR\.IntelliJIdea13\config\plugins\chronon\lib\recorder\native\recorderagent64-3.0.7.dll is not a valid Win32 application. )
    [2014-04-10 05:05:25,839] Artifact com.otpp.tim.enterpriseApp.ear: Server is not connected. Deploy is not available.
    JVMJ9VM015W Initialization error for library j9jvmti24(-3): JVMJ9VM009E J9VMDllMain failed
    Detected server admin port: 8880
    Could not create the Java virtual machine.
    Detected server http port: 9081
    Disconnected from server

    If I run the same build config without chrono there are no problems. Any idea what could be causing this?

    Thanks!

  21. Alexandr says:

    INVOKEDYNAMIC instruction is not supported (((

  22. Robert says:

    Does not work with Groovy / Grails. You get tons of errors. Seems that closures of any kind are not supported.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">