Launching Rails (jruby script/server) hangs

I was following the tutorial for getting JRuby on Rails running in 120
seconds
(http://blog.emptyway.com/2008/04/08/120-seconds-guide-to-jruby-on-rails/
) and I just got hung up on the last step. The guide calls for
installing mongrel (where mongrel-java was installed by the gem
command). I created a project, setup the database.yml file, created
the scaffold for the first model, and migrated the database…
However, when I run ‘jruby script/server’, the process starts up but I
never see any messages in the console indicating that the server has
completed its startup. As I watch the CPU monitor, I can see that the
java process is running and taking a lot of cycle time doing
something, but whatever is going on never actually gets the server to
a state where it can begin handling requests. I get the same result
trying ‘mongrel_rails start’.

My environment consists of OS X (10.5.4), JDK 1.6.0_05, JRuby 1.1.4,
and mongrel.1.1.5-java. I installed Rails twice in trying to get
this working (v2.1.1 and v2.0.4), but had the same trouble with each.

This is the first time for me trying to run Rails from JRuby (all of
my previous Rails experience is running from MRI). Has anyone else
experienced this?

–Mario

Hi Mario,

On Sat, Sep 13, 2008 at 6:53 AM, Mario A. [email protected]
wrote:

of cycle time doing something, but whatever is going on never actually gets
the server to a state where it can begin handling requests. I get the same
result trying ‘mongrel_rails start’.

My environment consists of OS X (10.5.4), JDK 1.6.0_05, JRuby 1.1.4, and
mongrel.1.1.5-java. I installed Rails twice in trying to get this working
(v2.1.1 and v2.0.4), but had the same trouble with each.

This is the first time for me trying to run Rails from JRuby (all of my
previous Rails experience is running from MRI). Has anyone else experienced
this?

I haven’t heard of this problem lately. Can you send a SIGQUIT (kill
-QUIT) to the hanging java process? It should dump a bunch of thread
stack traces on the console. Post the contents of that here to help us
with troubleshooting.

Cheers,
/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi Nick,

Here is the thread dump:

mario:~/projects/jruby/rest$ jruby script/server
2008-09-13 05:53:03
Full thread dump Java HotSpot™ 64-Bit Server VM (1.6.0_05-b13-52
mixed mode):

“Low Memory Detector” daemon prio=5 tid=0x0000000101844800
nid=0x12a0f7000 runnable [0x0000000000000000…0x0000000000000000]
java.lang.Thread.State: RUNNABLE

“CompilerThread1” daemon prio=9 tid=0x0000000101843000 nid=0x129ff4000
waiting on condition [0x0000000000000000…0x0000000129ff23e0]
java.lang.Thread.State: RUNNABLE

“CompilerThread0” daemon prio=9 tid=0x0000000101841800 nid=0x129ef1000
waiting on condition [0x0000000000000000…0x0000000129eef3e0]
java.lang.Thread.State: RUNNABLE

“Signal Dispatcher” daemon prio=9 tid=0x0000000101841000
nid=0x129dee000 waiting on condition
[0x0000000000000000…0x0000000000000000]
java.lang.Thread.State: RUNNABLE

“Finalizer” daemon prio=8 tid=0x0000000101829800 nid=0x129ceb000 in
Object.wait() [0x0000000129cea000…0x0000000129ceaad0]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000010f738128> (a
java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
- locked <0x000000010f738128> (a java.lang.ref.ReferenceQueue
$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:
159)

“Reference Handler” daemon prio=10 tid=0x0000000101828800
nid=0x129be8000 in Object.wait()
[0x0000000129be7000…0x0000000129be7ad0]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000010f738208> (a java.lang.ref.Reference
$Lock)
at java.lang.Object.wait(Object.java:485)
at java.lang.ref.Reference
$ReferenceHandler.run(Reference.java:116)
- locked <0x000000010f738208> (a java.lang.ref.Reference$Lock)

“main” prio=5 tid=0x0000000101801000 nid=0x100401000 runnable
[0x00000001003fc000…0x0000000100400c70]
java.lang.Thread.State: RUNNABLE
at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
at
java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:228)
at java.io.File.isFile(File.java:778)
at
org.jruby.runtime.load.LoadService.findFile(LoadService.java:503)
at
org.jruby.runtime.load.LoadService.findLibrary(LoadService.java:402)
at
org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:267)
at
org.jruby.runtime.load.LoadService.require(LoadService.java:357)
at org.jruby.RubyKernel.require(RubyKernel.java:818)
at org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER
$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER
$require.gen)
at
org
.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:
151)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.call(CallSite.java:391)
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:
57)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.RescueNode.executeBody(RescueNode.java:222)
at
org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:
144)
at org.jruby.ast.RescueNode.interpret(RescueNode.java:107)
at org.jruby.ast.BeginNode.interpret(BeginNode.java:80)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at
org
.jruby
.internal
.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163)
at
org
.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:
140)
at
org
.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:
253)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.cacheAndCall(CallSite.java:156)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.call(CallSite.java:394)
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:
57)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)
at org.jruby.ast.RootNode.interpret(RootNode.java:126)
at org.jruby.Ruby.loadFile(Ruby.java:2107)
at
org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58)
at
org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:331)
at
org.jruby.runtime.load.LoadService.require(LoadService.java:357)
at org.jruby.RubyKernel.require(RubyKernel.java:818)
at org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER
$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER
$require.gen)
at
org
.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:
151)
at
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:64)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.cacheAndCall(CallSite.java:156)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.call(CallSite.java:394)
at
ruby
.jit
.ruby
.Users.mario.dev.java.jruby_minus_1_dot_1_dot_4.lib.ruby.site_ruby.
$
1_dot_8
.rubygems.custom_require.require190331520_1700109224.rescue_1$RUBY
$rescue(custom_require.rb:32)
at
ruby
.jit
.ruby
.Users.mario.dev.java.jruby_minus_1_dot_1_dot_4.lib.ruby.site_ruby.
$
1_dot_8
.rubygems
.custom_require.require190331520_1700109224.file(custom_require.rb)
at
ruby
.jit
.ruby
.Users.mario.dev.java.jruby_minus_1_dot_1_dot_4.lib.ruby.site_ruby.
$
1_dot_8
.rubygems
.custom_require.require190331520_1700109224.file(custom_require.rb)
at
org
.jruby
.internal
.runtime.methods.DefaultMethod.retryJITCall(DefaultMethod.java:148)
at
org
.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:
138)
at org.jruby.RubyClass.invoke(RubyClass.java:333)
at
org.jruby.javasupport.util.RuntimeHelpers.invokeAs(RuntimeHelpers.java:
366)
at org.jruby.RubyObject.callSuper(RubyObject.java:685)
at
org
.jruby.javasupport.util.RuntimeHelpers.callZSuper(RuntimeHelpers.java:
624)
at ruby.jit.ruby.Users.mario.
$
_dot_rubygems
.gems
.activesupport_minus_2_dot_1_dot_1
.lib
.active_support.dependencies.require1150189359_1700109224.block_0$RUBY
$block(dependencies.rb:510)
at ruby.jit.ruby.Users.mario.
$
_dot_rubygems
.gems
.activesupport_minus_2_dot_1_dot_1
.lib
.active_support.dependencies.require1150189359_1700109224BlockCallback
$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:110)
at ruby.jit.ruby.Users.mario.
$
_dot_rubygems
.gems
.activesupport_minus_2_dot_1_dot_1
.lib
.active_support
.dependencies.new_constants_in413377160_1700109224.ensure_2$RUBY
$ensure(dependencies.rb:355)
at ruby.jit.ruby.Users.mario.
$
_dot_rubygems
.gems
.activesupport_minus_2_dot_1_dot_1
.lib
.active_support
.dependencies.new_constants_in413377160_1700109224.ensure_1$RUBY
$ensure(dependencies.rb:354)
at ruby.jit.ruby.Users.mario.
$
_dot_rubygems
.gems
.activesupport_minus_2_dot_1_dot_1
.lib
.active_support
.dependencies
.new_constants_in413377160_1700109224.file(dependencies.rb)
at
org.jruby.ast.executable.AbstractScript.file(AbstractScript.java:28)
at
org
.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:
265)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.callIter(CallSite.java:422)
at ruby.jit.ruby.Users.mario.
$
_dot_rubygems
.gems
.activesupport_minus_2_dot_1_dot_1
.lib
.active_support.dependencies.require1150189359_1700109224.rescue_1$RUBY
$rescue(dependencies.rb:510)
at ruby.jit.ruby.Users.mario.
$
_dot_rubygems
.gems
.activesupport_minus_2_dot_1_dot_1
.lib
.active_support
.dependencies.require1150189359_1700109224.file(dependencies.rb)
at
org.jruby.ast.executable.AbstractScript.file(AbstractScript.java:28)
at
org
.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:
244)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.call(CallSite.java:391)
at
org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.RescueNode.executeBody(RescueNode.java:222)
at
org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:
144)
at org.jruby.ast.RescueNode.interpret(RescueNode.java:107)
at org.jruby.ast.BeginNode.interpret(BeginNode.java:80)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at
org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:
202)
at
org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:190)
at org.jruby.runtime.Block.yield(Block.java:110)
at org.jruby.ast.YieldNode.interpret(YieldNode.java:95)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)
at org.jruby.ast.EnsureNode.interpret(EnsureNode.java:93)
at
org
.jruby
.internal
.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163)
at
org
.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:
140)
at
org
.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:
232)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.callIter(CallSite.java:371)
at
org.jruby.ast.FCallNoArgBlockNode.interpret(FCallNoArgBlockNode.java:31)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at
org
.jruby
.internal
.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163)
at
org
.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:
140)
at
org
.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:
253)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.cacheAndCall(CallSite.java:156)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.call(CallSite.java:394)
at
org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.RescueNode.executeBody(RescueNode.java:222)
at
org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:
144)
at org.jruby.ast.RescueNode.interpret(RescueNode.java:107)
at org.jruby.ast.BeginNode.interpret(BeginNode.java:80)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)
at org.jruby.ast.RootNode.interpret(RootNode.java:126)
at org.jruby.Ruby.loadFile(Ruby.java:2107)
at
org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58)
at
org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:331)
at
org.jruby.runtime.load.LoadService.require(LoadService.java:357)
at org.jruby.RubyKernel.require(RubyKernel.java:818)
at org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER
$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER
$require.gen)
at
org
.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:
151)
at
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:64)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.call(CallSite.java:391)
at
org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.RescueNode.executeBody(RescueNode.java:222)
at
org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:
144)
at org.jruby.ast.RescueNode.interpret(RescueNode.java:107)
at
org
.jruby
.internal
.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:163)
at
org
.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:
140)
at
org
.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:
253)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.cacheAndCall(CallSite.java:156)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.call(CallSite.java:394)
at script.server.file(server:3)
at script.server.file(server)
at script.server.load(server)
at org.jruby.Ruby.runScript(Ruby.java:544)
at org.jruby.Ruby.runNormally(Ruby.java:457)
at org.jruby.Ruby.runFromMain(Ruby.java:330)
at org.jruby.Main.run(Main.java:214)
at org.jruby.Main.run(Main.java:100)
at org.jruby.Main.main(Main.java:84)

“VM Thread” prio=9 tid=0x0000000101820800 nid=0x129ae5000 runnable

“VM Periodic Task Thread” prio=10 tid=0x0000000101846000
nid=0x12a1fa000 waiting on condition

“Exception Catcher Thread” prio=10 tid=0x0000000101802000
nid=0x100504000 runnable
JNI global references: 717

Heap
def new generation total 12032K, used 5635K [0x0000000105000000,
0x0000000105d60000, 0x000000010f6a0000)
eden space 10368K, 54% used [0x0000000105000000,
0x0000000105580348, 0x0000000105a20000)
from space 1664K, 0% used [0x0000000105bc0000,
0x0000000105bc0ab0, 0x0000000105d60000)
to space 1664K, 0% used [0x0000000105a20000,
0x0000000105a20000, 0x0000000105bc0000)
tenured generation total 27296K, used 20895K [0x000000010f6a0000,
0x0000000111148000, 0x0000000124400000)
the space 27296K, 76% used [0x000000010f6a0000,
0x0000000110b07ee8, 0x0000000110b08000, 0x0000000111148000)
compacting perm gen total 21248K, used 21005K [0x0000000124400000,
0x00000001258c0000, 0x0000000129800000)
the space 21248K, 98% used [0x0000000124400000,
0x0000000125883790, 0x0000000125883800, 0x00000001258c0000)
No shared spaces configured.

Charles,

Sorry for the late reply… The version of JRuby I used for this was
1.1.4 and I see the hanging behavior in both Rails v2.0.4 & 2.1.1.
This was the first time I tried to launch Rails using JRuby so I can’t
tell you how long this has been happening. If this problem does not
occur for everyone with a similar environment, I am inclined to think
that it has something to do with my own development machine. Does
starting Rails (using mongrel-java) on JRuby 1.1.4 work for you?

–Mario

Yes, it has always worked fine for me, and I know there are others
running mongrel on a daily basis. Is it possible it’s just really slow
for some reason? Running on a network share perhaps? The “main” thread
in your stack dump appears to still be running and not blocked on a lock
or IO.

Mario A. wrote:

–Mario

2008-09-13 05:53:03
nid=0x129ef1000 waiting on condition
- waiting on <0x000000010f738128> (a
java.lang.Thread.State: WAITING (on object monitor)
at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
org.jruby.runtime.load.LoadService.require(LoadService.java:357)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:253)
org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:58)
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:64)
at
at
at
ruby.jit.ruby.Users.mario.$_dot_rubygems.gems.activesupport_minus_2_dot_1_dot_1.lib.active_support.dependencies.require1150189359_1700109224.file(dependencies.rb)
at
at org.jruby.runtime.Block.yield(Block.java:110)
at
at
at org.jruby.ast.RescueNode.interpret(RescueNode.java:107)
org.jruby.runtime.load.LoadService.require(LoadService.java:357)
org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at
at org.jruby.Ruby.runFromMain(Ruby.java:330)
def new generation total 12032K, used 5635K [0x0000000105000000,
0x0000000110b07ee8, 0x0000000110b08000, 0x0000000111148000)

I was following the tutorial for getting JRuby on Rails running in 120
script/server’, the process starts up but I never see any messages

this?
To unsubscribe from this list, please visit:


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

What JRuby version and Rails version is this? Did it just start
recently?

Mario A. wrote:

nid=0x12a0f7000 runnable [0x0000000000000000…0x0000000000000000]
“Signal Dispatcher” daemon prio=9 tid=0x0000000101841000 nid=0x129dee000
- locked <0x000000010f738128> (a java.lang.ref.ReferenceQueue$Lock)
- locked <0x000000010f738208> (a java.lang.ref.Reference$Lock)
at

    at 

org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:331)
at
at
org.jruby.javasupport.util.RuntimeHelpers.invokeAs(RuntimeHelpers.java:366)
at org.jruby.runtime.CompiledBlock.yield(CompiledBlock.java:120)
at
at
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.runtime.Block.yield(Block.java:110)
at

org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:394)
at org.jruby.Ruby.loadFile(Ruby.java:2107)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:151)
at org.jruby.ast.RescueNode.interpret(RescueNode.java:107)
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:156)
at org.jruby.Main.run(Main.java:100)

0x0000000111148000, 0x0000000124400000)
On Sep 13, 2008, at 8:39 AM, Nick S. wrote:

mongrel (where mongrel-java was installed by the gem command). I
actually gets
previous Rails experience is running from MRI). Has anyone else


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email