Bug: Thread waiting forever in RunnableBlockingQueue.swap()

73 views
Skip to first unread message

Yannick Lecaillez

unread,
Oct 19, 2012, 11:10:30 AM10/19/12
to jetla...@googlegroups.com
Hi,

This is a really hard to reproduce bug (once a week on a loaded production machine) and it has the fatal impact
to make all threads unresponsive one after other.

Looking at the code, we didn't succeed to see a case where the swap() method could be called while the buffer
is empty.

Any idea ?

Thanks for your help.
Yannick.

Here the stack track kept from a thread dump:
Thread t@87
   java.lang.Thread.State: WAITING
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for <6bdba9dc> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1987)
        at org.jetlang.core.RunnableBlockingQueue.swap(RunnableBlockingQueue.java:42)
        at org.jetlang.fibers.PoolFiber.flush(PoolFiber.java:62)
        at org.jetlang.fibers.PoolFiber.access$000(PoolFiber.java:19)
        at org.jetlang.fibers.PoolFiber$1.run(PoolFiber.java:36)
        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:662)

   Locked ownable synchronizers:
        - locked <59bd6cee> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) 

Mike Rettig

unread,
Oct 19, 2012, 3:08:43 PM10/19/12
to jetla...@googlegroups.com
There is a subtle thread race with the pool. There is an empty check
on the pool thread that could be inconsistent when another thread in
the pool is flushing the same queue.

I committed a patch.

http://code.google.com/p/jetlang/source/detail?r=724
http://code.google.com/p/jetlang/source/detail?r=723

Mike
> --
> You received this message because you are subscribed to the Google Groups
> "jetlang-dev" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/jetlang-dev/-/DiCqgg8GvyUJ.
> To post to this group, send email to jetla...@googlegroups.com.
> To unsubscribe from this group, send email to
> jetlang-dev...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jetlang-dev?hl=en.

Frédéric BOUCHER

unread,
Oct 22, 2012, 5:26:31 AM10/22/12
to jetla...@googlegroups.com
Thanks for the patch!

I did some tests, the patch seems to solve the problem. 

When will you release a new version including this patch?

Frédéric

Mike Rettig

unread,
Oct 29, 2012, 9:54:08 PM10/29/12
to jetla...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages