Find Java race conditions

Now you can find race conditions automatically with vmlens. A race condition occours, when two or more threads access the same field without synchronization.

The VMLens plugin runs with all eclipse versions greater 3.6.2. VMLens finds data races in java programs running on a oracle jvm. All oracle releases since jdk 1.5 are supported.

Eclipse plugin, free trial version. Put the jar file into the plugins folder of your eclipse installation and restart eclipse

How does it work?

VMLens records the threads for all field modifications. If a field is modified by more than one thread without synchronization, vmlens has found a data race for you.

See all data races inside an eclipse view. You see the fields accessed together with the threads and stack traces. The following example shows you some data races found in eclpise kepler:

VMLens shows you the fields, which were accessed without synchronization. For each field VMLens shows all threads together with the stack trace.

In Eclipse

Simply enable vmlens inside the run configuration:

In the test and production enviroment

Use the vmlens standalone agent. Include the following line in your jdk options:

java -javaagent:[Path to unzipped vmlens.zip]\vmlens\agent.jar=[Path to a file with the ending .vmlens]

For Example:

java -javaagent:C:\vmlens\agent.jar=C:\TEMP\eclipse.properties

Configure the agent with the vmlens.properties file with the following properties:

  • file= Path to the log.vmlens file. For example: C\:\\TEMP\\log.vmlens
  • percent= Percentage of fields which will be traced.
  • filter= Comma separated list of packages and classes which will be filtered out. For example: sun,java.lang

After the agent has found all data races, you can open the log.vmlens file withe eclipse. Of course first install the vmlens eclipse plugin.

Download

Standalone agent, free trial version.