Klaus and I are happy to announce that our paper on Racer, a dynamic race detection approach to Java, has just won an ACM SIGSOFT Distinguished Paper Award at this year’s ISSTA conference. Thanks! (clap)
Racer paper wins SIGSOFT Distinguished Paper Award
Eric | July 23, 2008Off to Seattle
Eric | July 17, 2008I’ll be off to Seattle for the next week, presenting at Microsoft and attending ISSTA to present my paper on Racer. From what I’ve heard, Seattle is supposed to be quite beautiful, especially around this time of the year. I’ll tell you next week, so stay tuned 😉
A monitoring solution to the data races in the JDK
Eric | June 16, 2008A 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.
Data races in the JDK!
Eric | June 14, 2008At the moment I am doing some more work on evaluating tracematches ahead-of-time. One tracematch patten that we use in our benchmarks we called ASyncIter, a simplified version of which looks as follows:
tracematch(Collection c) { sym sync after returning: call(* Collections.synchr*(..)) && args(c); sym iter before: call(* Collection.iterator()) && target(c); sync iter { if(!Thread.holdsLock(c)) error(``Have to synchronize iterator at ''+thisJoinPoint); } }
This tracematch reports an error if you create a synchronized collection and then iterate over this collection without holding a lock on the collection object. According to the JDK javadoc this is forbidden as it can lead to a race condition. One has to use synchronized collections as follows:
False positives and negatives of the Racer algorithm
Eric | June 11, 2008Today I gave a presentation about Racer in our lab seminar and people asked me some really interesting questions. I thought the answers might interest other people too so I would post them here…
Can Racer produce false positives?
Yes, Racer can produce false positives but out of our 70 reported races only two were false positives. There are two primary reasons for false positives. First reason (quoting from the paper):
Soot 2.3.0 is available
Eric | June 3, 2008 I am pleased to announce that Soot version 2.3.0 is now available.
This release contains the following additions and improvements:
- Integrated new JastAdd-based frontend with support for Java 5 source code. Thanks to Torbjorn Ekman for contributing his frontend and his implementation of Java2Jimple!
- At the very least if -validate is on, Soot now checks that @this is only assigned in the first statement of an instance method. This has always been an implicit assumption for Jimple code but up until now was not enforced.
- Integrated full support for preserving annotations in Jimple and writing them to bytecode. SOURCE level annotations are preserved if code is read from source and the flag -p jb preserve-source-annotations is given. (does not hold for package and local variable annotations) SOURCE level annotations are not written into bytecode by Soot. Annotations can easily be added to SootClass, SootMethod and SootField instances using the utility class AnnotationGenerator. Thanks to Will Benton!
- Java 5 Annotations for fields, classes, parameters and methods are now fully preserved in bytecode. Jasmin was changed to implement this support.
- Ben Bellamy from Oxford University contributed a new implementation for the type assigner. This is to be published under the title Efficient Local Type Inference at OOPSLA ’08. The new type assigner is usually faster (it is applied when processing bytecode), and sometimes more precise. In particular it should always infer the most narrow type possible. Ben has tested this code, and verified that it provides a typing that is at least as tight as the original algorithm (tighter in 2914 methods out of 295598) on a number of benchmarks. These are: abc-complete.jar, BlueJ, CSO (Scala code), Gant, Groovy, havoc.jar, Java 3D, jEdit, Java Grande Forum, Jigsaw, Jython, Kawa, rt.jar, Kawa, Scala and tools.jar. The mean execution time improvement is around 10 times, but for the longest methods (abc parser methods and havoc with >9000 statements) the improvement is between 200 and 500 times. There are new phase options in jb.tr that allow to switch back to the old type assigner or to compare both implementations. The command line option -use-old-type-assigner was removed. It used to enabled an even older version of the type assigner (based on bit vectors) that was commented out any way. I flagged the appropriate code as deprecated. It may be removed in future versions of Soot. Thanks Ben!
Also we incorporated fixes to numerous bugs. Thanks for reporting bugs and/or providing fixes!
You can find more information in the full change log.
Why God Never Got Tenure
Eric | May 24, 2008 Credits go to this webpage 😉
- He had only one major publication.
- It was in Hebrew.
- It had no references.
- It wasn’t published in a refereed journal.
- Some even doubt he wrote it himself.
- It may be true that he created the world, but what has he done since then?
- His cooperative efforts have been quite limited.
- The scientific community has had a hard time replicating his results.
- He never applied to the Ethics Board for permission to use human subjects.
- When one experiment went awry he tried to cover it up by drowning the subjects.
- When subjects didn’t behave as predicted, he deleted them from the sample.
- He rarely came to class, just told students to read the Book.
- Some say he had his son teach the class.
- He expelled his first two students for learning.
- Although there were only ten requirements, most students failed his tests.
- His office hours were infrequent and usually held on a mountaintop.
varargs is patented!?
Eric | May 23, 2008Varargs is a feature that allows you to pass a variable-length list of arguments to a method, e.g. in Java 5. The implementation in Java boxes these arguments automatically into an array, which makes the implementation backwards compatible. As I just found out, this technique has actually been patented by HP. Interesting… I wonder whether Sun actually licensed that technology for Java somehow.
Racer: Effective Race Detection Using AspectJ
Eric | May 7, 2008I am happy to announce the availability of my latest publication (joint work with Klaus Havelund, to appear at ISSTA 2008). This time it’s about how to detect data races in multi-threaded Java programs using three novel pointcuts that we implemented as a language extension to AspectJ, and using a novel algorithm called Racer that makes use of these pointcuts. We applied our implementation to the NASA K9 Rover Excecutive and found 70 data races, only one of which was known to NASA developers, although extensive studies had been performed on the code, using all sorts of error detection tools, at a time where 68 of these races were already present!
Download the paper here, our extended Technical Report here, or continue reading here.
Crashing javac
Eric | April 18, 2008As I am preparing to hold COMP 520 in Fall, I just read through Michael Schwarzbach’s excellent new version of this lecture. He has one set of exercises on name resolution containing this funny example:
public class java { public class lang { public class Object {} } }
Give this code to javac and it will bail on you:
mucuna /tmp $ javac java.java An exception has occurred in the compiler (1.6.0_05). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you. java.lang.NullPointerException at com.sun.tools.javac.comp.Flow.visitIdent(Flow.java:1214) at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:1547)
Funny, eh?