Wednesday, 5 December 2012

Byteman 2.1.2 has been released

Byteman 2.1.2 is now available for download. You can obtain a copy either as a binary-only or full-source zip from the project downloads page or you can depend upon the version available in the Maven Central repository.

Byteman 2.1.2 is for the most part a maintenance update to release 2.1.0, fixing about half a dozen bugs. However, it does include a few new features. In particular:
  • Allow downcasts when initialising local vars in the BIND clause
  • Support computing object size as a standard method in Helper
Downcasting is particularly helpful when dealing with generic types when you know that a specific type parameter is used. For example when injecting into this class

class Foo
    void foo(List names)
    . . .

downcasting allows you to bind elements of the argument list using the type String rather than the generic type Object

RULE access name as a name
BIND first : String = $names.get(0);
     second : String = $names.get(1);
IF first == "Andrew" && second == "Dinn"
DO throw new Exception("Won't get fooed again!")

Of course, Byteman performs a checkcast before binding the variables so when the rule executes if you try to downcast a value which is not an instance of the subtype your program will see a ClassCastException.

If you want to disable downcasting and revert to the old behaviour where the type checker flags this as a type error the simply set system property


 in the JVM running the Byteman agent.

Thursday, 9 August 2012

Byteman 2.1.0 has been released

Byteman 2.1.0 has just been released and is available from Maven Central and the Byteman downloads page at

This patch release contains a small number of bug fixes and feature upgrades. Many thanks to Ivo Studensky for contributing some nice extensions to the dtest contrib package.

Tuesday, 29 May 2012

Byteman 2.0.3 released and now available from Maven Central

Byteman 2.0.3 has been released and is now accessible from the Byteman downloads page.

Release 2.0.3 is a minor patch upgrade to release 2.0.1 which simply fixes a few minor bugs. However, the main benefit of this release is that the Byteman jars and ZIP file downloads are now distributed via the Maven Central repository.

Tuesday, 13 March 2012

Byteman 2.0.1 Released

The Byteman 2.0.1 release is now available from the JBoss maven repo and from the byteman downloads page.

This is mostly a patch release which fixes a miscellany of small but perfectly formed issues recently uncovered by our intrepid user community. However, it does also include two exciting new functions, contributed courtesy of JBoss community member Kenji Suzuki and our very own Bela Ban:
  • provide Windows batch script equivalents for the Linux command scripts used to drive Byteman (thanks Kenji!
  • modify BMUnit to look for rule scripts mentioned in @BMScript annotations as resources on the classpath before resorting to loading from the local file system (neat idea, Bela!

Wednesday, 8 February 2012

Byteman Talk at FOSDEM

I just got back from my first ever FOSDEM where I spent half my time at the Universite Libre de Bruxelles in the Free Java room hearing some of the latest and finest scoops on free open source Java. The other half of my time was spent in Brussels' old town sampling some of the earliest and finest beers known to mankind. The Java talks were of a very high standard and very entertaining and the questions and answers revealed just how sharp the audience were. As for the beer, well after a Delirium Tremens and several Kasteel Reds at Delirium Cafe it did not seem that life could get any better.

On Saturday just before heading off for the dinner and then on to A La Mort Subite I gave a talk about Byteman to the assembled Java gurus. Heiko Rupp (JBoss RHQ/JON) was in the audience filming. So, (many) thanks to him you can watch the talk as well as download the slides. The links are also posted on the Byteman docs page along with all the other talks and papers from the last few years.

I was immensely surprised, amused and delighted when on Sunday Karl Helgason included an extra off the cuff demo into his talk on his exceptionally clever MIDI synthesizer project Gervill. Karl was very taken with my Byteman demo and was determined to find a way to apply it. So, after dinner on Saturday night he stayed up late reading the Byteman Programmer's Guide and then proceeded to implement a demo which used Byteman to show off Gervill.

Karl injected Byteman rules into implementations of the add, get and remove methods for interface List so that a note or drumbeat was triggered each time they were called. The rule used the integer index argument either to pitch the note or to select the drum to beat. He ran up Tomcat on OpenJDK and after about 3 seconds of intense cacophony summarised the ensuing calm with the single word "bootstrapped".

Karl proceeded to demo his own musical virtuosity, raising laughs from the whole room as he turned the Web GUI into an instrument simply by clicking on its icons and controls. This included zithering the mouse up and down the icons in the title bar which provided a perfectly pitched rising and falling scale. I don't think anyone has ever provided a better example of Tomcat's scalability, performance and fine-tuning.

Tuesday, 10 January 2012

Byteman 2.0.0 Released

Byteman 2.0.0 has been released. It includes a small number of bug fixes and new features and is available from the Byteman download page. If you are using Byteman from maven then the jars are available via the JBoss repository.

The release is accompanied by part two of the Byteman tutorial series, Fault Injection Testing With Byteman.

Monday, 9 January 2012

Byteman Squashes Drools Bug

Martin Vecera is a senior member of our JBoss QE staff and one the Byteman project power users. He recognised Byteman's potential in its very early days and has provided valuable feedback during its development and been the project evangelist to our QE team. Martin has written up a very nice example of using Byteman for debugging and diagnosing a problem in Drools.

Using a conventional debugger is infeasible when a program repeatedly invokes the routine you want to investigate inside a long-running control loop. Product trace can help in such circumstances but it often fails because switching it on produces far more data than you actually need and does not always print the information you actually want to see.

So, Martin injected a simple Byteman rule into precisely the calls he is interested in and used a helper class to dump the critical data to a file in exactly the format he wants. Using Byteman he was able to inject the specific, controlled tracing behaviour he needed just where he needed it with out incurring any extra overheads. Enjoy.