org.jruby.RubyThreadGroup.addDirectly livelock
----------------------------------------------

                 Key: JRUBY-3212
                 URL: http://jira.codehaus.org/browse/JRUBY-3212
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.1.5
         Environment: # uname -a
Linux somehost 2.6.18-6-amd64 #1 SMP Fri Jun 6 05:24:08 UTC 2008 x86_64 
GNU/Linux
# java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode)

            Reporter: Xuân Baldauf
            Assignee: Thomas E Enebo


I'm running JRuby on Rails with the glassfish gem and a custom application. 
This application also spawns new threads during query processing using JRuby's 
"Thread.new". About 20 requests may be handled simultaneously. With JRuby 1.1.5 
(but apparently not with JRuby 1.1.4), apparently some threads may go into a 
livelock (or some other form of deadlock with 100% CPU usage). I've managed to 
reproduce such a livelock with 3 threads eating up the CPU time of 3 cores. 
Their Java stack traces looks as follows:


"Thread-988" daemon prio=10 tid=0x00002aacc3c02400 nid=0x2e23 runnable 
[0x0000000041135000..0x0000000041139ac0]
   java.lang.Thread.State: RUNNABLE
        at java.util.HashMap.put(HashMap.java:374)
        at org.jruby.RubyThreadGroup.addDirectly(RubyThreadGroup.java:101)
        - locked <0x00002aaae3e99b20> (a org.jruby.RubyThread)
        at org.jruby.RubyThread.initialize(RubyThread.java:199)
        at org.jruby.RubyThread.startThread(RubyThread.java:217)
        at org.jruby.RubyThread.start(RubyThread.java:162)
        at 
org.jruby.RubyThread$s_method_0_0$RUBYFRAMEDINVOKER$start.call(org/jruby/RubyThread$s_method_0_0$RUBYFRAMEDINVOKER$start.gen)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:226)
        at 
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:98)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.timeout.timeout155490200_1594025746.ensure_1$RUBY$__ensure___0(timeout.rb:52)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.timeout.timeout155490200_1594025746.__file__(timeout.rb:50)
        at 
org.jruby.ast.executable.AbstractScript.__file__(AbstractScript.java:35)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:309)
        at 
org.jruby.internal.runtime.methods.WrapperMethod.call(WrapperMethod.java:82)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:165)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.timeout.timeout1549403946_1594025746.__file__(timeout.rb:76)
        at 
org.jruby.ast.executable.AbstractScript.__file__(AbstractScript.java:31)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:267)
        at 
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:139)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.protocol.rbuf_fill325037740_1858381859.__file__(protocol.rb:132)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:204)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:73)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.protocol.readuntil561573596_1497749648.rescue_1$RUBY$__rescue___0(protocol.rb:116)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.protocol.readuntil561573596_1497749648.__file__(protocol.rb:114)
        at 
org.jruby.ast.executable.AbstractScript.__file__(AbstractScript.java:31)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:246)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:114)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.protocol.readline1653261827_828729837.__file__(protocol.rb:126)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:204)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:73)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.http.read_status_line854221179_1154455325.__file__(http.rb:2031)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:246)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:114)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.http.read_new408760662_1588611802.__file__(http.rb:2020)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:246)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:114)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.http.request1587241578_79817663.rescue_1$RUBY$__rescue___0(http.rb:1059)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.http.request1587241578_79817663.__file__(http.rb:1058)
        at 
org.jruby.ast.executable.AbstractScript.__file__(AbstractScript.java:35)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:309)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:310)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:167)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.http.request1587241578_79817663.block_0$RUBY$__block__(http.rb:1046)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.http.request1587241578_79817663BlockCallback$block_0$RUBY$__block__xx1.call(Unknown
 Source)
        at org.jruby.runtime.CompiledBlock.yield(CompiledBlock.java:120)
        at org.jruby.runtime.Block.yield(Block.java:124)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.http.start1820567858_1588611802.ensure_1$RUBY$__ensure___0(http.rb:547)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.http.start1820567858_1588611802.__file__(http.rb:545)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:225)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:270)
        at 
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:100)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.http.request1587241578_79817663.__file__(http.rb:1044)
        at 
org.jruby.ast.executable.AbstractScript.__file__(AbstractScript.java:31)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:267)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:290)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:126)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.net.http.request_get431073419_134373063.__file__(http.rb:957)
        at 
org.jruby.ast.executable.AbstractScript.__file__(AbstractScript.java:31)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:246)
        at 
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:280)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:116)
[...]

"Thread-970" daemon prio=10 tid=0x00002aacbfecbc00 nid=0x2de8 runnable 
[0x000000006b9dd000..0x000000006b9dfbc0]
   java.lang.Thread.State: RUNNABLE
        at java.util.HashMap.put(HashMap.java:374)
        at org.jruby.RubyThreadGroup.addDirectly(RubyThreadGroup.java:101)
        - locked <0x00002aaae3b1e8d8> (a org.jruby.RubyThread)
        at org.jruby.RubyThread.initialize(RubyThread.java:199)
        at org.jruby.RubyThread.startThread(RubyThread.java:217)
        at org.jruby.RubyThread.start(RubyThread.java:162)
        at 
org.jruby.RubyThread$s_method_0_0$RUBYFRAMEDINVOKER$start.call(org/jruby/RubyThread$s_method_0_0$RUBYFRAMEDINVOKER$start.gen)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:226)
        at 
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:98)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.timeout.timeout155490200_1594025746.ensure_1$RUBY$__ensure___0(timeout.rb:52)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.timeout.timeout155490200_1594025746.__file__(timeout.rb:50)
        at 
org.jruby.ast.executable.AbstractScript.__file__(AbstractScript.java:35)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:309)
        at 
org.jruby.internal.runtime.methods.WrapperMethod.call(WrapperMethod.java:82)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:165)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.$1_dot_8.timeout.timeout1549403946_1594025746.__file__(timeout.rb:76)
        at 
org.jruby.ast.executable.AbstractScript.__file__(AbstractScript.java:31)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:267)
        at 
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:139)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.gems.$1_dot_8.gems.activesupport_minus_2_dot_1_dot_2.lib.active_support.vendor.memcache_minus_client_minus_1_dot_5_dot_0.memcache.socket1097048357_1355962037.rescue_1$RUBY$__rescue___1(memcache.rb:798)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.gems.$1_dot_8.gems.activesupport_minus_2_dot_1_dot_2.lib.active_support.vendor.memcache_minus_client_minus_1_dot_5_dot_0.memcache.socket1097048357_1355962037.ensure_1$RUBY$__ensure___0(memcache.rb:797)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.gems.$1_dot_8.gems.activesupport_minus_2_dot_1_dot_2.lib.active_support.vendor.memcache_minus_client_minus_1_dot_5_dot_0.memcache.socket1097048357_1355962037.__file__(memcache.rb)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:204)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:73)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.gems.$1_dot_8.gems.activesupport_minus_2_dot_1_dot_2.lib.active_support.vendor.memcache_minus_client_minus_1_dot_5_dot_0.memcache.request_setup695070888_1053791578.__file__(memcache.rb:663)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:246)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:114)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.gems.$1_dot_8.gems.activesupport_minus_2_dot_1_dot_2.lib.active_support.vendor.memcache_minus_client_minus_1_dot_5_dot_0.memcache.get561494183_415750060.rescue_1$RUBY$__rescue___0(memcache.rb:231)
        at 
ruby.jit.ruby.usr.local.lib.jruby_minus_1_dot_1_dot_5.lib.ruby.gems.$1_dot_8.gems.activesupport_minus_2_dot_1_dot_2.lib.active_support.vendor.memcache_minus_client_minus_1_dot_5_dot_0.memcache.get561494183_415750060.__file__(memcache.rb)
        at 
org.jruby.ast.executable.AbstractScript.__file__(AbstractScript.java:31)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:246)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:114)

[...]

"httpHttpWorkerThread-3000-6" daemon prio=10 tid=0x00002aacbdab8000 nid=0x29f6 
runnable [0x0000000046d8f000..0x0000000046d95cc0]
   java.lang.Thread.State: RUNNABLE
        at java.util.HashMap.put(HashMap.java:374)
        at org.jruby.RubyThreadGroup.addDirectly(RubyThreadGroup.java:101)
        - locked <0x00002aaae28d8d98> (a org.jruby.RubyThread)
        at org.jruby.RubyThread.initialize(RubyThread.java:199)
        at 
org.jruby.RubyThread$i_method_0_0$RUBYFRAMEDINVOKER$initialize.call(org/jruby/RubyThread$i_method_0_0$RUBYFRAMEDINVOKER$initialize.gen)
        at org.jruby.RubyClass.finvoke(RubyClass.java:353)
        at 
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:298)
        at org.jruby.RubyObject.callMethod(RubyObject.java:713)
        at org.jruby.RubyObject.callInit(RubyObject.java:737)
        at org.jruby.RubyThread.startThread(RubyThread.java:214)
        at org.jruby.RubyThread.newInstance(RubyThread.java:152)
        at 
org.jruby.RubyThread$s_method_0_0$RUBYFRAMEDINVOKER$newInstance.call(org/jruby/RubyThread$s_method_0_0$RUBYFRAMEDINVOKER$newInstance.gen)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:261)
        at 
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:180)


Apparently, there seems to be a problem with RubyThreadGroup.addDirectly.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to