March 13, 2016

metracer — New Release 1.3.2

New version of metracer 1.3.2 was just released. Compared to a previously announced 1.2.0 release following main changes happened:

# Change Description
 1 Dynamic instrumentation Now it’s possible to inject tracing into a running Java process without any restarts! One can repeat this many times for different classes and methods. After one is finished with experiments all instrumentation traces can be removed leaving application in an original state.
To ease metracer.jar launching a frontend script – metracer.sh – was introduced. One only needs this single script (without any additional bits) to start working! There are a built-in usage notice and help message for a quick on-boarding.
Such dynamic instrumentation was made possible by the use of Java Attach API and  JMX technologies
2 No more promiscuous patching of  ClassLoader Such patching was introduced as an aid against isolation imposed by JavaEE app servers (e.g. WildFly).
It was found another more elegant way to workaround this based on the fact that metracer bits are loaded into a system ClassLoader (see here). Given this one could easily resolve reference to a com.develorium.metracer.Runtime class from any point of program via code:

By using the code snippet above one doesn’t need anymore to patch any class loaders!
3 Improved stability of instrumentation Several design flaws and bugs in an instrumentation code were identified and fixed which lead to java.lang.VerifyError:

  • each call to Runtime.traceEntry or Runtime.traceExit is guarded with try / catch  block. As such any failures there won’t affect inferior application itself
  • proper boxing / unboxing of return value / exception on the stack
  • proper placement of RETURN opcode which is crucial for some reason for static class initializers ( <clinit>  method)

With these changes metracer is now a fully functional developer tool ready for hard use in production! Enjoy the POWER of METRACER!