I am using JRuby / Rails / Glassfish Gem to run an app on Tomcat.
When someone submits a large file as an uploaded file I see the
following in the log:
Processing ScholarshipsController#create (for 174.120.167.34 at
2009-12-21 10:03:13) [POST]
Parameters:
{“authenticity_token”=>“9c26734a0f31…bf3a9d644e9001abb931”,
“scholarship”=>{…data removed for privacy…}
Dec 21, 2009 10:03:15 AM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Servlet.service() for servlet default threw exception
java.lang.OutOfMemoryError: Java heap space
at org.jruby.util.Pack.unpack(Pack.java:924)
at org.jruby.RubyString.unpack(RubyString.java:6806)
at org.jruby.RubyString$i_method_1_0$RUBYINVOKER$unpack.call
(org/
jruby/RubyString$i_method_1_0$RUBYINVOKER$unpack.gen)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall
(CachingCallSite.java:310)
at org.jruby.runtime.callsite.CachingCallSite.call
(CachingCallSite.java:149)
at
ruby.jit.ruby.home.mfromin.jvm.apache_minus_tomcat_minus_6_dot_0_dot_14.domains.scholarships_dot_sam_dot_org.SamScholar.WEB_minus_INF.gems.gems.activerecord_minus_jdbc_minus_adapter_minus_0_dot_9_dot_2.lib.jdbc_adapter.jdbc_mysql.quote17997250_17974850.file
(jdbc_mysql.rb:82)
at
ruby.jit.ruby.home.mfromin.jvm.apache_minus_tomcat_minus_6_dot_0_dot_14.domains.scholarships_dot_sam_dot_org.SamScholar.WEB_minus_INF.gems.gems.activerecord_minus_jdbc_minus_adapter_minus_0_dot_9_dot_2.lib.jdbc_adapter.jdbc_mysql.quote17997250_17974850.file
(jdbc_mysql.rb)
at org.jruby.ast.executable.AbstractScript.file
(AbstractScript.java:51)
at org.jruby.internal.runtime.methods.JittedMethod.call
(JittedMethod.java:187)
at org.jruby.runtime.callsite.CachingCallSite.call
(CachingCallSite.java:187)
at
ruby.jit.ruby.home.mfromin.jvm.apache_minus_tomcat_minus_6_dot_0_dot_14.domains.scholarships_dot_sam_dot_org.SamScholar.WEB_minus_INF.gems.gems.activerecord_minus_2_dot_2_dot_2.lib.active_record.base.attributes_with_quotes1213394_2293223.block_0$RUBY
$block(base.rb:2817)
at
ruby.jit.ruby.home.mfromin.jvm.apache_minus_tomcat_minus_6_dot_0_dot_14.domains.scholarships_dot_sam_dot_org.SamScholar.WEB_minus_INF.gems.gems.activerecord_minus_2_dot_2_dot_2.lib.active_record.base.attributes_with_quotes1213394_2293223BlockCallback
$block_0$RUBY$__block__xx1.call(Unknown Source)
at org.jruby.runtime.CompiledBlock.yield(CompiledBlock.java:
105)
at org.jruby.runtime.Block.yield(Block.java:194)
at org.jruby.RubyArray.eachCommon(RubyArray.java:1635)
at org.jruby.RubyArray.each(RubyArray.java:1642)
at org.jruby.RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$each.call
(org/
jruby/RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$each.gen)
at org.jruby.runtime.callsite.CachingCallSite.callBlock
(CachingCallSite.java:116)
at org.jruby.runtime.callsite.CachingCallSite.callIter
(CachingCallSite.java:133)
at
ruby.jit.ruby.home.mfromin.jvm.apache_minus_tomcat_minus_6_dot_0_dot_14.domains.scholarships_dot_sam_dot_org.SamScholar.WEB_minus_INF.gems.gems.activerecord_minus_2_dot_2_dot_2.lib.active_record.base.attributes_with_quotes1213394_2293223.file
(base.rb:2808)
at
ruby.jit.ruby.home.mfromin.jvm.apache_minus_tomcat_minus_6_dot_0_dot_14.domains.scholarships_dot_sam_dot_org.SamScholar.WEB_minus_INF.gems.gems.activerecord_minus_2_dot_2_dot_2.lib.active_record.base.attributes_with_quotes1213394_2293223.file
(base.rb)
at org.jruby.internal.runtime.methods.JittedMethod.call
(JittedMethod.java:102)
at org.jruby.internal.runtime.methods.DefaultMethod.call
(DefaultMethod.java:147)
at org.jruby.internal.runtime.methods.AliasMethod.call
(AliasMethod.java:76)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall
(CachingCallSite.java:280)
at org.jruby.runtime.callsite.CachingCallSite.call
(CachingCallSite.java:69)
at
ruby.jit.ruby.home.mfromin.jvm.apache_minus_tomcat_minus_6_dot_0_dot_14.domains.scholarships_dot_sam_dot_org.SamScholar.WEB_minus_INF.gems.gems.activerecord_minus_jdbc_minus_adapter_minus_0_dot_9_dot_2.lib.active_record.connection_adapters.jdbc_adapter.attributes_with_quotes24825033_2293223.file
(jdbc_adapter.rb:67)
at
ruby.jit.ruby.home.mfromin.jvm.apache_minus_tomcat_minus_6_dot_0_dot_14.domains.scholarships_dot_sam_dot_org.SamScholar.WEB_minus_INF.gems.gems.activerecord_minus_jdbc_minus_adapter_minus_0_dot_9_dot_2.lib.active_record.connection_adapters.jdbc_adapter.attributes_with_quotes24825033_2293223.file
(jdbc_adapter.rb)
at org.jruby.ast.executable.AbstractScript.file
(AbstractScript.java:43)
at org.jruby.internal.runtime.methods.JittedMethod.call
(JittedMethod.java:119)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall
(CachingCallSite.java:290)
at org.jruby.runtime.callsite.CachingCallSite.call
(CachingCallSite.java:109)
Dec 21, 2009 10:07:42 AM org.apache.catalina.core.ApplicationContext
log
Is this issue caused on the upload itself or when the file is
attempting to be persisted to MySQL? Is it caused when the file is
uploaded but not yet persisted?
What is the best way to address this? Can I limit the size of the
file uploaded?
I currently have 64MB heap space - I can update this but don’t want to
spend more $$ with my host if there is a better solution.
–
You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.