Stephen Owens created JENA-400: ---------------------------------- Summary: Hang when running tests that depend on Jena in parallel using Maven Key: JENA-400 URL: https://issues.apache.org/jira/browse/JENA-400 Project: Apache Jena Issue Type: Bug Components: Jena Affects Versions: Jena 2.10.0 Reporter: Stephen Owens
Running multiple test classes that use Jena can cause a hang during JUnit test execution. We reduced this to two separate test classes, each with only one test, roughly as follows: import java.io.IOException; import org.junit.Test; import com.hp.hpl.jena.rdf.model.ModelFactory; public class FirstJenaTest { @Test public void test() throws IOException { ModelFactory.createDefaultModel(); } } TEST 2: import org.junit.Test; import com.hp.hpl.jena.query.Query; public class SecondJenaTest { @Test public void test() { new Query(); } } pom.xml: ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <parallel>classes</parallel> <includes> <include>**/FirstJenaTest.java</include> <include>**/SecondJenaTest.java</include> </includes> </configuration> . . . </plugin> ... Here's part of the thread dump we captured: "pool-1-thread-2" prio=5 tid=7fb9be6f5800 nid=0x1159a7000 in Object.wait() [1159a4000] java.lang.Thread.State: RUNNABLE at org.apache.jena.riot.RIOT.<clinit>(RIOT.java:38) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at com.hp.hpl.jena.rdf.model.impl.IO_Ctl.callByRefection(IO_Ctl.java:54) at com.hp.hpl.jena.rdf.model.impl.IO_Ctl.init(IO_Ctl.java:36) - locked <7f3883170> (a java.lang.Object) at com.hp.hpl.jena.rdf.model.impl.ModelCom.<clinit>(ModelCom.java:65) at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:140) at xx.FirstJenaTest.test(FirstJenaTest.java:xx) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.apache.maven.surefire.junitcore.ClassDemarcatingRunner.run(ClassDemarcatingRunner.java:58) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:24) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680) "pool-1-thread-1" prio=5 tid=7fb9be0d8000 nid=0x1158a4000 in Object.wait() [1158a1000] java.lang.Thread.State: RUNNABLE at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:140) at com.hp.hpl.jena.vocabulary.OWL.<clinit>(OWL.java:36) at com.hp.hpl.jena.sparql.ARQConstants.<clinit>(ARQConstants.java:44) at com.hp.hpl.jena.query.ARQ.<clinit>(ARQ.java:70) at com.hp.hpl.jena.query.Query.<clinit>(Query.java:63) at xx.SecondJenaTest.test(SecondJenaTest.java:xx) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.apache.maven.surefire.junitcore.ClassDemarcatingRunner.run(ClassDemarcatingRunner.java:58) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:24) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira