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.

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.

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 Run → Run ‘ChrononDemo’ with Chronon menu.

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 Run → Open Chronon Recording action in the main menu.

Debug actions

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

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.

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

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

Switch between threads

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

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.

Logging

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

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.

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.

45 Responses to Try Chronon Debugger with IntelliJ IDEA 13.1 EAP

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).

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.

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)

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)?

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?

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.

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.

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.

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).

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.

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.

Calling this a debugger is misleading. It only records variable and field values. You can’t evaluate expressions or navigate object hierarchies. The logging feature only outputs toString() on the variable value.