Skip to content

Instantly share code, notes, and snippets.

@asppsa
Last active Sep 9, 2019
Embed
What would you like to do?
ConditionVariable ping pong
^\2019-09-09 16:20:11
Full thread dump OpenJDK 64-Bit Server VM (25.222-b05 mixed mode):
"Ruby-0-Thread-1: /home/asp/src/moneta/test.rb:1" #12 daemon prio=5 os_prio=0 tid=0x00007fc848952000 nid=0x7ce0 waiting on condition [0x00007fc830a2b000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x000000076e5638c8> (a java.util.concurrent.Semaphore$NonfairSync)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1037)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1328)
at java.util.concurrent.Semaphore.tryAcquire(Semaphore.java:409)
at org.jruby.RubyThread$SleepTask2.run(RubyThread.java:1540)
at org.jruby.RubyThread$SleepTask2.run(RubyThread.java:1529)
at org.jruby.RubyThread.executeTask(RubyThread.java:1581)
at org.jruby.RubyThread.sleep(RubyThread.java:1453)
at org.jruby.RubyThread.sleep(RubyThread.java:2203)
at org.jruby.RubyThread.sleep(RubyThread.java:2193)
at org.jruby.ext.thread.Mutex.sleep(Mutex.java:136)
at org.jruby.ext.thread.Mutex$INVOKER$i$sleep.call(Mutex$INVOKER$i$sleep.gen)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:172)
at org.jruby.ext.thread.ConditionVariable.wait_ruby(ConditionVariable.java:90)
at org.jruby.ext.thread.ConditionVariable.wait_ruby(ConditionVariable.java:81)
at org.jruby.ext.thread.ConditionVariable$INVOKER$i$wait_ruby.call(ConditionVariable$INVOKER$i$wait_ruby.gen)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:172)
at home.asp.src.moneta.test.invokeOther0:wait(/home/asp/src/moneta/test.rb:7)
at home.asp.src.moneta.test.RUBY$block$\=\|home\|asp\|src\|moneta\|test\,rb$2(/home/asp/src/moneta/test.rb:7)
at java.lang.invoke.LambdaForm$DMH/1072591677.invokeStatic_L6_L(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$BMH/92150540.reinvoke(LambdaForm$BMH)
at java.lang.invoke.LambdaForm$MH/274001481.invokeExact_MT(LambdaForm$MH)
at org.jruby.runtime.CompiledIRBlockBody.yieldDirect(CompiledIRBlockBody.java:146)
at org.jruby.runtime.IRBlockBody.yieldSpecific(IRBlockBody.java:85)
at org.jruby.runtime.Block.yieldSpecific(Block.java:139)
at org.jruby.RubyKernel.loop(RubyKernel.java:1425)
at org.jruby.RubyKernel$INVOKER$s$0$0$loop.call(RubyKernel$INVOKER$s$0$0$loop.gen)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:365)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:153)
at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:160)
at home.asp.src.moneta.test.invokeOther7:loop(/home/asp/src/moneta/test.rb:6)
at home.asp.src.moneta.test.RUBY$block$\=\|home\|asp\|src\|moneta\|test\,rb$1(/home/asp/src/moneta/test.rb:6)
at java.lang.invoke.LambdaForm$DMH/1072591677.invokeStatic_L6_L(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$BMH/92150540.reinvoke(LambdaForm$BMH)
at java.lang.invoke.LambdaForm$MH/274001481.invokeExact_MT(LambdaForm$MH)
at org.jruby.runtime.CompiledIRBlockBody.yieldDirect(CompiledIRBlockBody.java:146)
at org.jruby.runtime.IRBlockBody.yieldSpecific(IRBlockBody.java:85)
at org.jruby.runtime.Block.yieldSpecific(Block.java:139)
at org.jruby.ext.thread.Mutex.synchronize(Mutex.java:160)
at org.jruby.ext.thread.Mutex$INVOKER$i$0$0$synchronize.call(Mutex$INVOKER$i$0$0$synchronize.gen)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:365)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:153)
at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:160)
at home.asp.src.moneta.test.invokeOther9:synchronize(/home/asp/src/moneta/test.rb:5)
at home.asp.src.moneta.test.RUBY$block$\=\|home\|asp\|src\|moneta\|test\,rb$0(/home/asp/src/moneta/test.rb:5)
at java.lang.invoke.LambdaForm$DMH/1072591677.invokeStatic_L6_L(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$BMH/662822946.reinvoke(LambdaForm$BMH)
at java.lang.invoke.LambdaForm$MH/274001481.invokeExact_MT(LambdaForm$MH)
at org.jruby.runtime.CompiledIRBlockBody.callDirect(CompiledIRBlockBody.java:136)
at org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:77)
at org.jruby.runtime.Block.call(Block.java:129)
at org.jruby.RubyProc.call(RubyProc.java:295)
at org.jruby.RubyProc.call(RubyProc.java:274)
at org.jruby.RubyProc.call(RubyProc.java:270)
at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:105)
at java.lang.Thread.run(Thread.java:748)
"Service Thread" #8 daemon prio=9 os_prio=0 tid=0x00007fc8480d2800 nid=0x7cdc runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C1 CompilerThread2" #7 daemon prio=9 os_prio=0 tid=0x00007fc8480bd000 nid=0x7cdb waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x00007fc8480bb800 nid=0x7cda waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x00007fc8480b8800 nid=0x7cd9 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Signal Dispatcher" #4 daemon prio=9 os_prio=0 tid=0x00007fc8480b7000 nid=0x7cd8 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Finalizer" #3 daemon prio=8 os_prio=0 tid=0x00007fc848084000 nid=0x7cd7 in Object.wait() [0x00007fc832e8b000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000006c5603858> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
- locked <0x00000006c5603858> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:165)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:216)
"Reference Handler" #2 daemon prio=10 os_prio=0 tid=0x00007fc848081800 nid=0x7cd6 in Object.wait() [0x00007fc83308c000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000006c560ad38> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
- locked <0x00000006c560ad38> (a java.lang.ref.Reference$Lock)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
"main" #1 prio=5 os_prio=0 tid=0x00007fc84800b000 nid=0x7cd0 waiting on condition [0x00007fc84db82000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000006c5880990> (a java.util.concurrent.Semaphore$NonfairSync)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1037)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1328)
at java.util.concurrent.Semaphore.tryAcquire(Semaphore.java:409)
at org.jruby.RubyThread$SleepTask2.run(RubyThread.java:1540)
at org.jruby.RubyThread$SleepTask2.run(RubyThread.java:1529)
at org.jruby.RubyThread.executeTask(RubyThread.java:1581)
at org.jruby.RubyThread.sleep(RubyThread.java:1453)
at org.jruby.RubyThread.sleep(RubyThread.java:2203)
at org.jruby.RubyThread.sleep(RubyThread.java:2193)
at org.jruby.ext.thread.Mutex.sleep(Mutex.java:136)
at org.jruby.ext.thread.Mutex$INVOKER$i$sleep.call(Mutex$INVOKER$i$sleep.gen)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:172)
at org.jruby.ext.thread.ConditionVariable.wait_ruby(ConditionVariable.java:90)
at org.jruby.ext.thread.ConditionVariable.wait_ruby(ConditionVariable.java:81)
at org.jruby.ext.thread.ConditionVariable$INVOKER$i$wait_ruby.call(ConditionVariable$INVOKER$i$wait_ruby.gen)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:172)
at home.asp.src.moneta.test.invokeOther15:wait(/home/asp/src/moneta/test.rb:22)
at home.asp.src.moneta.test.RUBY$block$\=\|home\|asp\|src\|moneta\|test\,rb$4(/home/asp/src/moneta/test.rb:22)
at java.lang.invoke.LambdaForm$DMH/1072591677.invokeStatic_L6_L(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$BMH/92150540.reinvoke(LambdaForm$BMH)
at java.lang.invoke.LambdaForm$MH/274001481.invokeExact_MT(LambdaForm$MH)
at org.jruby.runtime.CompiledIRBlockBody.yieldDirect(CompiledIRBlockBody.java:146)
at org.jruby.runtime.IRBlockBody.yieldSpecific(IRBlockBody.java:85)
at org.jruby.runtime.Block.yieldSpecific(Block.java:139)
at org.jruby.RubyKernel.loop(RubyKernel.java:1425)
at org.jruby.RubyKernel$INVOKER$s$0$0$loop.call(RubyKernel$INVOKER$s$0$0$loop.gen)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:365)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:153)
at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:160)
at home.asp.src.moneta.test.invokeOther17:loop(/home/asp/src/moneta/test.rb:18)
at home.asp.src.moneta.test.RUBY$block$\=\|home\|asp\|src\|moneta\|test\,rb$3(/home/asp/src/moneta/test.rb:18)
at java.lang.invoke.LambdaForm$DMH/1072591677.invokeStatic_L6_L(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$BMH/92150540.reinvoke(LambdaForm$BMH)
at java.lang.invoke.LambdaForm$MH/274001481.invokeExact_MT(LambdaForm$MH)
at org.jruby.runtime.CompiledIRBlockBody.yieldDirect(CompiledIRBlockBody.java:146)
at org.jruby.runtime.IRBlockBody.yieldSpecific(IRBlockBody.java:85)
at org.jruby.runtime.Block.yieldSpecific(Block.java:139)
at org.jruby.ext.thread.Mutex.synchronize(Mutex.java:160)
at org.jruby.ext.thread.Mutex$INVOKER$i$0$0$synchronize.call(Mutex$INVOKER$i$0$0$synchronize.gen)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:365)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:153)
at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:160)
at home.asp.src.moneta.test.invokeOther26:synchronize(/home/asp/src/moneta/test.rb:17)
at home.asp.src.moneta.test.RUBY$script(/home/asp/src/moneta/test.rb:17)
at java.lang.invoke.LambdaForm$DMH/980546781.invokeStatic_L7_L(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$BMH/407858146.reinvoke(LambdaForm$BMH)
at java.lang.invoke.LambdaForm$MH/1897871865.invoker(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/2109957412.invokeExact_MT(LambdaForm$MH)
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
at org.jruby.ir.Compiler$1.load(Compiler.java:89)
at org.jruby.Ruby.runScript(Ruby.java:854)
at org.jruby.Ruby.runNormally(Ruby.java:777)
at org.jruby.Ruby.runNormally(Ruby.java:795)
at org.jruby.Ruby.runFromMain(Ruby.java:607)
at org.jruby.Main.doRunFromMain(Main.java:412)
at org.jruby.Main.internalRun(Main.java:304)
at org.jruby.Main.run(Main.java:234)
at org.jruby.Main.main(Main.java:206)
"VM Thread" os_prio=0 tid=0x00007fc848078000 nid=0x7cd5 runnable
"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x00007fc848020000 nid=0x7cd1 runnable
"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x00007fc848021800 nid=0x7cd2 runnable
"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x00007fc848023800 nid=0x7cd3 runnable
"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x00007fc848025000 nid=0x7cd4 runnable
"VM Periodic Task Thread" os_prio=0 tid=0x00007fc8480dc000 nid=0x7cdd waiting on condition
JNI global references: 681
Heap
PSYoungGen total 75264K, used 31628K [0x000000076c780000, 0x0000000775a80000, 0x00000007c0000000)
eden space 64512K, 49% used [0x000000076c780000,0x000000076e6632f0,0x0000000770680000)
from space 10752K, 0% used [0x0000000770680000,0x0000000770680000,0x0000000771100000)
to space 10752K, 0% used [0x0000000775000000,0x0000000775000000,0x0000000775a80000)
ParOldGen total 119808K, used 3932K [0x00000006c5600000, 0x00000006ccb00000, 0x000000076c780000)
object space 119808K, 3% used [0x00000006c5600000,0x00000006c59d7130,0x00000006ccb00000)
Metaspace used 30902K, capacity 31838K, committed 32000K, reserved 1075200K
class space used 5110K, capacity 5284K, committed 5376K, reserved 1048576K
m = Mutex.new
c = ConditionVariable.new
t = Thread.new do
m.synchronize do
loop do
c.wait(m)
puts "pong"
c.signal
end
end
end
sleep 0.1 until t.stop?
m.synchronize do
loop do
puts "ping"
c.signal
c.wait(m)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment