Aspect-oriented Race Detection in Java

Eric | September 3, 2010

TSE PaperOur paper on Aspect-oriented Race Detection in Java (joint work with Klaus Havelund from NASA JPL) is now available on the TSE website and here. It’s part of a TSE special issue on best papers from ISSTA 2008.

The paper enhances the approach presented at ISSTA to also take thread spawns and joins into account. This addresses an omission in the original algorithm raised by Bill Pugh during the ISSTA conference.

Abstract:

In the past researchers have developed specialized programs to aid programmers detecting concurrent programming errors such as deadlocks, livelocks, starvation and data races. In this work we propose a language extension to the aspect-oriented programming language AspectJ, in the form of three new pointcuts, lock(), unlock() and maybeShared(). These pointcuts allow programmers to monitor program events where locks are granted or handed back, and where values are accessed that may be shared amongst multiple Java threads. We decide thread-locality using a static thread-local-objects analysis developed by others. Using the three new primitive pointcuts, researchers can directly implement efficient monitoring algorithms to detect concurrent-programming errors online. As an example, we describe a new algorithm which we call RACER, an adaption of the well-known ERASER algorithm to the memory model of Java. We implemented the new pointcuts as an extension to the AspectBench Compiler, implemented the RACER algorithm using this language extension and then applied the algorithm to the NASA K9 Rover Executive and two smaller programs. Our experiments demonstrate that our implementation is effective in finding subtle data races. In the Rover Executive RACER finds 12 data races, with no false warnings. Only one of these races was previously known.

A monitoring solution to the data races in the JDK

Eric | June 16, 2008

A few days ago I blogged about a few really subtle data races that can easily be triggered in the JDK, when invoking methods like containsAll on synchronized (!) collections. In the following code you can get a race on sl2 because sl1.containsAll(sl2) synchronizes on sl1 only, not on the argument sl2!

List sl1 = Collections.synchronizedList(new ArrayList());
List sl2 = Collections.synchronizedList(new ArrayList());
sl1.containsAll(sl2);


Here are now two easy aspect-oriented solutions to this problem, first in form of a tracematch, then in form of a normal AspectJ aspect. You can download the tracematch here and the plain AspectJ aspect here.

Read the rest of this entry »

Comments
Comments Off on A monitoring solution to the data races in the JDK
Categories
Research
Tags
AspectJ, Bug finding, Data races, tracematches