Debugging of Java applications with ABRT

Updated -

What is ABRT

ABRT is Automatic Bug Reporting Tool. The tool attempts to detect failures of applications, gather as much information as possible and submit these data for analysis to Red Hat engineers.

Why should we use ABRT

By using ABRT we could decrease the time necessary for resolution of issues because the reports made by ABRT contain a lot of information which someone would have to answer when reporting an issues on his/her own.

ABRT Java support

ABRT provides a JVM agent library for easier reporting of uncaught Java exceptions. The agent can report both caught and uncaught exceptions, but by default it reports only the uncaught exceptions. The agent can also report the exceptions into systemd-journal, syslog and a regular file.

What kind of information it gathers

Except general information about a package where the exception occurred and detailed information about your system, ABRT gathers the backtrace, which is slightly extended standard Java stack trace, and a couple of information about Java runtime itself from System Properties:

  • sun.java.command
  • sun.java.launcher
  • sun.boot.class.path
  • sun.boot.library.path
  • java.home
  • java.class.path
  • java.library.path
  • java.ext.dirs
  • java.endorsed.dirs
  • java.vm.version
  • java.vm.name
  • java.vm.info
  • java.vm.vendor
  • java.vm.specification.name
  • java.vm.specification.vendor
  • java.vm.specification.version

Questions about performance impact

In order to be able to report even uncaught exceptions, the agent must register several JVMTI event callbacks and this technology and as well the processing inside of the event callbacks have not-insignificant impact on the performance of an entire application.
The performance might be decreased by 6% (the minimal measured degradation) up to 17% (the maximal measured degradation).

How to enable ABRT for Java

A JVM agent is a dynamic library loaded by Java on user request. So ABRT JVM agent provides such a library and stores it on local file system in file:

/var/lib64/libabrt-java-connector.so

RHEL8:
/usr/lib/abrt-java-connector/libabrt-java-connector.so

In order to force Java to load that library, the user must issue java command with an additional argument -agentpath or -agentlib. The first one accepts a full path to agent library and the latter one accepts a file name which will be searched in $LD_LIBRARY_PATH.

However, this is not very convenient way of enabling ABRT, thus java-1.7.0-openjdk-headless do this instead of users.

Binary java is replaced by a shell script which checks whether the ABRT agent library exists and if so, runs Java with the following on its command line arguments:

-agentpath:/usr/lib64/libabrt-java-connector.so

The ABRT JVM agent library is delivered by abrt-java-connector package and hence once you install this package, the reporting of Java exceptions is enabled.

$ yum install abrt-java-connector

The only way of disabling the ABRT Java agent is to remove abrt-java-connector package from your system.

$ yum erase abrt-java-connector

Find more information about abrt-java-connector in /usr/share/doc/abrt-java-connector-$VERSION/README file shipped with the package.

Comments