JRuby on Rails heap/memory problems

Hi there,

I have a Ruby on Rails application that I am attempting porting to JRuby
running in a Tomcat container. I use the latest stable Tomcat, JRuby
1.1.4,
and a proper warble setup. Previously, the application has deployed
successfully on Tomcat, but suddenly the application runs out of heap
space:

Processing ConfigurationController#index (for 0:0:0:0:0:0:0:1%0 at
2008-09-26 14:39:25) [GET]
Session ID: 23b0d54451e6525dadd89208bf45f2f0
Parameters: {“controller”=>“configuration”, “action”=>“index”}
Rendering template within layouts/main_configuration
Rendering configuration/index

Sep 26, 2008 2:40:01 PM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Servlet.service() for servlet default threw exception
java.lang.OutOfMemoryError: Java heap space
at org.joni.Regex.setupBMSkipMap(Regex.java:259)
at org.joni.Regex.setExactInfo(Regex.java:285)
at org.joni.Analyser.setOptimizedInfoFromTree(Analyser.java:2195)
at org.joni.Analyser.compile(Analyser.java:148)
at org.joni.Regex.(Regex.java:127)
at org.joni.Regex.(Regex.java:104)
at org.jruby.RubyRegexp.makeRegexp(RubyRegexp.java:301)
at org.jruby.RubyRegexp.initialize(RubyRegexp.java:291)
at org.jruby.RubyRegexp.newRegexp(RubyRegexp.java:178)
at org.jruby.RubyString.getPattern(RubyString.java:2339)
at org.jruby.RubyString.split(RubyString.java:2195)
at org.jruby.RubyString.splitCommon(RubyString.java:2179)
at org.jruby.RubyString.split(RubyString.java:2149)
at
org.jruby.RubyString$i_method_multi$RUBYINVOKER$split.call(org/jruby/RubyString$i_method_multi$RUBYINVOKER$split.gen)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:391)
at
ruby.jit.ruby.Users.aj.jruby.apache_minus_tomcat_minus_6_dot_0_dot_18.webapps.ROOT.WEB_minus_INF.gems.gems.activesupport_minus_2_dot_1_dot_1.lib.active_support.inflector.constantize16298613_2220220.file(inflector.rb:280)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:244)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:391)
at
ruby.jit.ruby.Users.aj.jruby.apache_minus_tomcat_minus_6_dot_0_dot_18.webapps.ROOT.WEB_minus_INF.gems.gems.activesupport_minus_2_dot_1_dot_1.lib.active_support.core_ext.string.inflections.constantize11444328_2220220.file(inflections.rb:143)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:202)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:340)
at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)
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.call(CallSite.java:391)
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
at org.jruby.ast.InstAsgnNode.interpret(InstAsgnNode.java:88)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)
Sep 26, 2008 2:40:02 PM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Servlet.service() for servlet default threw exception
java.lang.OutOfMemoryError: Java heap space
at java.nio.CharBuffer.allocate(CharBuffer.java:312)
at
java.nio.charset.CharsetEncoder.isLegalReplacement(CharsetEncoder.java:321)
at
java.nio.charset.CharsetEncoder.replaceWith(CharsetEncoder.java:267)
at java.nio.charset.CharsetEncoder.(CharsetEncoder.java:186)
at java.nio.charset.CharsetEncoder.(CharsetEncoder.java:209)
at sun.nio.cs.ISO_8859_1$Encoder.(ISO_8859_1.java:116)
at sun.nio.cs.ISO_8859_1$Encoder.(ISO_8859_1.java:113)
at sun.nio.cs.ISO_8859_1.newEncoder(ISO_8859_1.java:46)
at java.lang.StringCoding$CharsetSE.(StringCoding.java:321)
at java.lang.StringCoding$CharsetSE.(StringCoding.java:312)
at java.lang.StringCoding.encode(StringCoding.java:369)
at java.lang.String.getBytes(String.java:812)
at org.jruby.util.ByteList.plain(ByteList.java:677)
at org.jruby.util.ByteList.create(ByteList.java:671)
at
org.jruby.parser.DefaultRubyParser.yyparse(DefaultRubyParser.java:2798)
at
org.jruby.parser.DefaultRubyParser.yyparse(DefaultRubyParser.java:829)
at
org.jruby.parser.DefaultRubyParser.parse(DefaultRubyParser.java:3334)
at org.jruby.parser.Parser.parse(Parser.java:113)
at org.jruby.parser.Parser.parse(Parser.java:79)
at org.jruby.Ruby.parseEval(Ruby.java:1937)
at
org.jruby.evaluator.ASTInterpreter.evalSimple(ASTInterpreter.java:176)
at org.jruby.RubyObject.evalUnder(RubyObject.java:1020)
at org.jruby.RubyObject.specificEval(RubyObject.java:999)
at org.jruby.RubyModule.module_eval(RubyModule.java:1923)
at
org.jruby.RubyModule$i_method_multi$RUBYFRAMEDINVOKER$module_eval.call(org/jruby/RubyModule$i_method_multi$RUBYFRAMEDINVOKER$module_eval.gen)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:186)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:493)
at
org.jruby.ast.CallThreeArgNode.interpret(CallThreeArgNode.java:61)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:67)
at org.jruby.ast.RescueNode.executeBody(RescueNode.java:222)
at
org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:144)


What can I do to resolve this mystery problem?

Best regards,

Anders

On Fri, Sep 26, 2008 at 5:45 AM, Anders Østergaard Jensen
[email protected] wrote:

at org.joni.Regex.setupBMSkipMap(Regex.java:259)
at org.joni.Regex.setExactInfo(Regex.java:285)

Sep 26, 2008 2:40:02 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet default threw exception
java.lang.OutOfMemoryError: Java heap space
at java.nio.CharBuffer.allocate(CharBuffer.java:312)
at
java.nio.charset.CharsetEncoder.isLegalReplacement(CharsetEncoder.java:321)

What can I do to resolve this mystery problem?

What has changed since the last time you had a successful deploy? Did
you upgrade JRuby, Warbler or Tomcat?

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email