LiveRecorder for Java is a newly released application for software failure replay. It enables developers to record application failures and then replay them in JetBrains' IntelliJ IDEA to find the cause of the failure. It helps to reduce the debugging time, especially with intermittent failures.
The LiveRecorder application records all the code execution steps of the application. Under the hood this means that X86 machine-level instructions are being recorded. The recording can be replayed, which is quite similar to the process of debugging, except this uses a recording instead of on a live application. This is especially helpful for debugging so-called intermittent failures that only occur sporadically. For instance, when an exception occurs because multiple threads access the same resource. Debugging intermittent failures on a live application is quite hard as you never know when they happen. With LiveRecorder, a recording of a failure is made and then it can be debugged using the replay functionality.
LiveRecorder can be used to record application failures in any environment. However, the recording results in a slowdown of 2 to 5 times for most programs. The team is working on improving the performance; in the meantime, it's probably best to avoid running it on production. It's also possible to record failures in tests; integrations for build tools are available. This makes it possible to run LiveRecorder as part of a continuous delivery pipeline with, for instance, Jenkins.
The process is divided into three parts: recording, replaying, and debugging in IntelliJ. The record and replay applications need to run on Linux, IntelliJ can run on any platform.
An agent is used to record the instructions of the application:
-XX:-Inline -XX:TieredStopAtLevel=1 -XX:UseAVX=2 -Dsun.zip.disableMemoryMapping=true -agentpath:/path/to/lr4j-record-1.0.so=save_on=always
There are various configuration options available, for instance, to configure the recording's filename.
After that the replay application is used to replay the recording:
/path/to/lr4j/lr4j_replay -i /path/to/recording.undo -cp classpath
Then the IntelliJ plugin can be used to connect to the replay application. After successfully connecting, it's time to debug the application. The most prominent addition of the IntelliJ plugin is the 'Application Timeline':
InfoQ reached out to VP of product Jonathan Harris to dive a bit more into LiveRecorder and have a peek into the future.
InfoQ: Can you tell everyone a bit more about yourself? What's your role at Undo and what does your day look like?
Jonathan Harris: I am the VP of product at Undo, and have over 20 years in the software industry in both development and marketing roles; including as a developer at Acorn and Psion, an engineering manager and product manager at Symbian Ltd, and CTO and product strategist at Tizen Association.
My day consists mainly of ensuring Undo is aligned across business units and properly equipped to provide our customers with cutting-edge products that deliver an enchanting user experience
InfoQ: LiveRecorder for Java was recently launched. Does it offer the same features as the other LiveRecorders?
Harris: LiveRecorder offers support for Java, C/C++ and Go programming languages, and enables developers to systematically record software failures, replay the recording to analyze execution history and resolve bugs fast.
Additional benefits of LiveRecorder for Java include:
A recording provides a 100% reproducible test case of a software failure that’s ready for analysis & debugging.A recording is portable for easy sharing of recordings with team members to accelerate MTTR.
A powerful integrated reversible debugger.
Replay recordings forward and backward to easily find the root cause of defects.
LiveRecorder plugs seamlessly into IntelliJ IDEA and developers’ workflow.
InfoQ: What was the reason to support Java instead of another programming language?
Harris: Java turned 25 this year, and has consistently ranked as a top three programming choice for developers. And while innovation in the space has certainly progressed in this timeframe, so too have complexities of its software failures.
LiveRecorder is the company’s flagship product, but up until this Java release it only supported C/C++ and Go applications. Obviously C++ is a big market, but it’s relatively niche. Java is a much larger application and we’re very excited to provide a critical offering in that space.
InfoQ: Can you describe the biggest challenge you faced when creating the Java version?
Harris: Recording of the JVM running HotSpot JIT compiled code and still displaying Java source-line debug.
InfoQ: Do you have plans for other (JVM) programming languages such as Kotlin?
Harris: In theory any code that runs on the JVM can be debugged in the tool, including Java, Kotlin, Clojure, Scala, and Jython. Kotlin is the next language that we intend to formally support. While the tool previously supported C, C++, and Go, the JVM adds dozens of potential languages to the mix. Because of its deep integration with the Linux kernel, Undo's technology today is focused on the Java Virtual Machine running on servers.
InfoQ: Which features are you working on for the next version(s)?
Harris: Visual Studio Code support - continued focus on improving DevX (developer experience) and adding support for this ever popular development platform.
Kotlin support - and possibly Scala but Kotlin seems to have more traction.
Live reversible debugging - being able to run a live application and reverse debug would be handy.