[ 
https://issues.apache.org/jira/browse/SUREFIRE-1430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16854987#comment-16854987
 ] 

Vladimir Sitnikov commented on SUREFIRE-1430:
---------------------------------------------

Just in case, here's a thread dump of the failure case.

 

It looks like maven-surefire creates a Semaphore with capacity of 1, and:

1) main thread acquires a permit just before {{at 
org.apache.maven.surefire.junitcore.pc.Scheduler.schedule(Scheduler.java:346)}}

2) pool-1-thread-1 tries to acquire another permit {{at 
org.apache.maven.surefire.junitcore.pc.Scheduler.schedule(Scheduler.java:342)}

It looks like "main thread" is executing "a suite" while "pool-1-thread-1" is 
executing tests.
I don't want to make quick judgements, however it looks like "suite executor" 
should not acquire permits in case its only purpose is to delegate work to a 
worker pool.

 
{noformat}
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.151-b12 mixed mode):
"pool-1-thread-1" #8 prio=5 os_prio=0 tid=0x00007f4f40326000 nid=0x12e5 waiting 
on condition [0x00007f4f29c33000]
   java.lang.Thread.State: WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x00000000e06102e0> (a 
java.util.concurrent.Semaphore$FairSync)
        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
        at 
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
        at 
java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:997)
        at 
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
        at java.util.concurrent.Semaphore.acquire(Semaphore.java:312)
        at 
org.apache.maven.surefire.junitcore.pc.ThreadResourcesBalancer.acquirePermit(ThreadResourcesBalancer.java:75)
        at 
org.apache.maven.surefire.junitcore.pc.Scheduler.schedule(Scheduler.java:342)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:27)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at 
org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:387)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
"Service Thread" #7 daemon prio=9 os_prio=0 tid=0x00007f4f40141000 nid=0x12e3 
runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
"C1 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x00007f4f4013e000 
nid=0x12e2 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x00007f4f4013b000 
nid=0x12e1 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
"Signal Dispatcher" #4 daemon prio=9 os_prio=0 tid=0x00007f4f40139800 
nid=0x12e0 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
"Finalizer" #3 daemon prio=8 os_prio=0 tid=0x00007f4f40107000 nid=0x12df in 
Object.wait() [0x00007f4f2ae4f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00000000e0008ec8> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
        - locked <0x00000000e0008ec8> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)
"Reference Handler" #2 daemon prio=10 os_prio=0 tid=0x00007f4f40102800 
nid=0x12de in Object.wait() [0x00007f4f2af50000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00000000e0006b68> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:502)
        at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
        - locked <0x00000000e0006b68> (a java.lang.ref.Reference$Lock)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
{noformat}

main thread:
{noformat}
"main" #1 prio=5 os_prio=0 tid=0x00007f4f40009800 nid=0x12da waiting on 
condition [0x00007f4f4617d000]
   java.lang.Thread.State: WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x00000000e0657bf8> (a 
java.util.concurrent.FutureTask)
        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
        at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:429)
        at java.util.concurrent.FutureTask.get(FutureTask.java:191)
        at 
org.apache.maven.surefire.junitcore.pc.SharedThreadPoolStrategy.finished(SharedThreadPoolStrategy.java:60)
        at 
org.apache.maven.surefire.junitcore.pc.Scheduler.finished(Scheduler.java:366)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:295)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:27)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at 
org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:387)
        at 
org.apache.maven.surefire.junitcore.pc.InvokerStrategy.schedule(InvokerStrategy.java:54)
        at 
org.apache.maven.surefire.junitcore.pc.Scheduler.schedule(Scheduler.java:346)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:27)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at 
org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:387)
        at 
org.apache.maven.surefire.junitcore.pc.InvokerStrategy.schedule(InvokerStrategy.java:54)
        at 
org.apache.maven.surefire.junitcore.pc.Scheduler.schedule(Scheduler.java:346)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at 
org.apache.maven.surefire.junitcore.pc.ParallelComputerBuilder$PC$1.run(ParallelComputerBuilder.java:535)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:108)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:78)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:54)
        at 
org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:144)
        at 
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
        at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
{noformat}

> Parallel parameterized JUnit test hangs on Linux
> ------------------------------------------------
>
>                 Key: SUREFIRE-1430
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1430
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Junit 4.7+ (parallel) support
>    Affects Versions: 2.18, 2.18.1, 2.19, 2.19.1, 2.20, 2.20.1
>         Environment: Linux/Ubuntu
>            Reporter: Christian Beikov
>            Assignee: Tibor Digana
>            Priority: Major
>             Fix For: 3.0.1
>
>
> This is a follow up of SUREFIRE-1264. The test case is here: 
> https://github.com/beikov/surefire-test
> The problem is, that a simple parameterized JUnit test hangs when running in 
> parallel mode on Linux.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to