Saturday, December 5, 2015

JMH - ERROR: Unable to find the resource: /META-INF/BenchmarkList

I tried to use micro benchmarking tool called JMH. It look really nice. I used it for speed verification of my B+Tree implementation. It's at https://github.com/jajir/jblinktree. I'm using eclipse for building project and after some time I met following exception:

Exception in thread "main" java.lang.RuntimeException: ERROR: Unable to find the resource: /META-INF/BenchmarkList
	at org.openjdk.jmh.runner.AbstractResourceReader.getReaders(AbstractResourceReader.java:96)
	at org.openjdk.jmh.runner.BenchmarkList.find(BenchmarkList.java:104)
	at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:228)
	at org.openjdk.jmh.runner.Runner.run(Runner.java:178)
	at com.coroptis.jblinktree.performance.MapTestRunner.main(MapTestRunner.java:75)

Problem is that class BenchmarkList didn't find file '/META-INF/BenchmarkList'. This file contains list of precompiled benchmark tests. This file was missing because I compile project form eclipse and not from maven. Solution is compile project from command link:

mvn clean install

And from now it's work fine. If you have problem to configure JMH in maven look at https://github.com/jajir/jblinktree/blob/master/benchmark/pom.xml.

Sunday, August 9, 2015

How to install jpf-concurrent module

JPF is tool for static code analysis. I tried to use it for proving that code is thread safe. In multiple thread environment is problem with JVM 'state explosion'. When JPF try to examine all possible JVM states in multiple thread environment number of possible states grow exorbitantly. As documentation say this problem could be solved with module jpf-concurrent.

Because I didn't find guide how to install it here is simple guide.

Prerequisites

Installation steps

  • Go to directory where is jpf-core installed. In my case it's directory '/Users/jan/projects/jpf/'
  • Checkout project
    hg clone http://babelfish.arc.nasa.gov/hg/jpf/jpf-concurrent
  • Build jpf-concurrent project
    ant
  • Edit your site property file. In my case is at '/Users/jan/.jpf/site.properties'. Add there following section:
    # concurrent extension
    jpf-concurrent = ${jpf.home}/jpf-concurrent
    extensions+=,${jpf-concurrent}
    
Ant it's done. Good luck.

[EDIT] - After some time of using jpf-concurrent project I had following problem:

gov.nasa.jpf.jvm.NoUncaughtExceptionsProperty
java.lang.IllegalMonitorStateException
at java.util.concurrent.locks.ReentrantLock.unlock(gov.nasa.jpf.concurrent.peers.JPF_java_util_concurrent_locks_ReentrantLock)
at com.coroptis.jblinktree.NodeLocks.unlockNode(NodeLocks.java:96)
at com.coroptis.jblinktree.NodeStoreImpl.unlockNode(NodeStoreImpl.java:59)

I contacted Nastaran Shafiei via google group, he is creator of jpf-concurrent. He told me, that jpf-concurrent module is outdated and no longer supported. So I removed jpf-concurrent module and path finder start work fine.

So, do NOT install jpf-concurrent module.