ArrayIndexOutOfBoundsException in threadsafe mode
-------------------------------------------------
Key: JRUBY-5239
URL: http://jira.codehaus.org/browse/JRUBY-5239
Project: JRuby
Issue Type: Bug
Components: Embedding
Affects Versions: JRuby 1.5.6, JRuby 1.5.3
Environment: MacOSX (1.5.3), Ubuntu 10.04(1.5.6)
Reporter: Marek Jelen
I have a rails application that embeds Jetty. Basically it works so, that a
rake task is run to start the application. In initializers are all required
jars loaded. In the rake task the Jetty server is started and custom handler is
passed to it. The handler when initializes starts the rails application with
Rack::Builder.parse_file("config.ru"). For each request the handler creates new
environment {} and builds it according to HttpServletRequest passed to the
handle, and with data from application builds HttpServletResponse.
Hopefully this makes sense and will help to solve the problem.
The actual problem is this:
java.lang.ArrayIndexOutOfBoundsException: 2
at org.jruby.RubyArray.collect(RubyArray.java:2354)
at
org.jruby.RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$collect.call(org/jruby/RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$collect.gen:65535)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:299)
at
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:117)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:122)
at
org.jruby.ast.CallNoArgBlockPassNode.interpret(CallNoArgBlockPassNode.java:53)
at org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
at org.jruby.ast.ClassVarAsgnNode.interpret(ClassVarAsgnNode.java:92)
at org.jruby.ast.OpAsgnOrNode.interpret(OpAsgnOrNode.java:99)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:156)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:289)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:108)
at org.jruby.ast.VCallNode.interpret(VCallNode.java:85)
at
org.jruby.ast.CallNoArgBlockPassNode.interpret(CallNoArgBlockPassNode.java:53)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:156)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:289)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:108)
at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:180)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:172)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:309)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.EnsureNode.interpret(EnsureNode.java:98)
at
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:180)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:172)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:309)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
at org.jruby.ast.ToAryNode.interpret(ToAryNode.java:69)
at org.jruby.ast.MultipleAsgnNode.interpret(MultipleAsgnNode.java:127)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:180)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:172)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:309)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
at
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:180)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:172)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:309)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:201)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:180)
at org.jruby.RubyClass.finvoke(RubyClass.java:542)
at org.jruby.RubyObject.send(RubyObject.java:1443)
at
org.jruby.RubyObject$i_method_multi$RUBYINVOKER$send.call(org/jruby/RubyObject$i_method_multi$RUBYINVOKER$send.gen:65535)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:339)
at
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:197)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
at
org.jruby.ast.CallSpecialArgBlockPassNode.interpret(CallSpecialArgBlockPassNode.java:66)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:113)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:138)
at
org.jruby.javasupport.util.RuntimeHelpers$MethodMissingMethod.call(RuntimeHelpers.java:401)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:190)
at
org.jruby.runtime.callsite.CachingCallSite.callMethodMissing(CachingCallSite.java:375)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
at org.jruby.ast.ToAryNode.interpret(ToAryNode.java:69)
at org.jruby.ast.MultipleAsgnNode.interpret(MultipleAsgnNode.java:127)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:113)
at
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:127)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:147)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:279)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:68)
at org.jruby.ast.CallManyArgsNode.interpret(CallManyArgsNode.java:59)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.RescueNode.executeBody(RescueNode.java:199)
at
org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:118)
at org.jruby.ast.RescueNode.interpret(RescueNode.java:110)
at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:113)
at
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:127)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:147)
at org.jruby.RubyClass.finvoke(RubyClass.java:644)
at
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:461)
at
org.jruby.javasupport.proxy.JavaProxyConstructor$2.invoke(JavaProxyConstructor.java:222)
at
org.jruby.proxy.org.eclipse.jetty.server.handler.AbstractHandler$Proxy0.handle(Unknown
Source)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)
at org.eclipse.jetty.server.Server.handle(Server.java:352)
at
org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:596)
at
org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1049)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:590)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:212)
at
org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)
at java.lang.Thread.run(Thread.java:680)
However the application works fine in development mode and I do not use my rake
task, but rails command to start it with webrick. It also works fine when
threadsafe! is disabled in rails.
I went down through the middlewares and all of them works, however the request
does not come to the Controller. From this I suppose, that the problem has to
be somewhere between rails & jruby with thread save mode.
These gems are used:
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.6)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.12)
Using actionmailer (3.0.3)
Using arel (2.0.6)
Using activerecord (3.0.3)
Using activerecord-jdbc-adapter (1.0.3)
Using jdbc-postgres (8.4.702)
Using activerecord-jdbcpostgresql-adapter (1.0.3)
Using activeresource (3.0.3)
Using bouncy-castle-java (1.5.0145.2)
Using bundler (1.0.3)
Using jruby-openssl (0.7.2)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Thanks in advance for any help.
Marek
--
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