AppEngine JRuby - OutOfMemoryError:Java 堆空间 - 可以解决吗?

发布于 2024-08-30 16:48:17 字数 2771 浏览 5 评论 0原文

我使用 AppEngine JRuby on Rails(SDK 版本 1.3.3.1) - 我经常遇到的一个问题是,在几次请求之后,服务器变得非常慢,直到它死掉并在终端(OSX)上抛出 OutOfMemoryError 。

请求本身非常轻量级,只不过是使用 DataMapper 查找实体或保存它。

在appspot上,这个问题没有发生。

有没有办法扩大JRuby的堆空间?

异常日志:

    Exception in thread "Timer-2" java.lang.OutOfMemoryError: Java heap space
Apr 29, 2010 8:08:22 AM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: Error for /users/close_users
java.lang.OutOfMemoryError: Java heap space
    at org.jruby.RubyHash.internalPut(RubyHash.java:480)
    at org.jruby.RubyHash.internalPut(RubyHash.java:461)
    at org.jruby.RubyHash.fastASet(RubyHash.java:837)
    at org.jruby.RubyArray.makeHash(RubyArray.java:2998)
    at org.jruby.RubyArray.makeHash(RubyArray.java:2992)
    at org.jruby.RubyArray.op_diff(RubyArray.java:3103)
    at org.jruby.RubyArray$i_method_1_0$RUBYINVOKER$op_diff.call(org/jruby/RubyArray$i_method_1_0$RUBYINVOKER$op_diff.gen)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:146)
    at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    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.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:373)
    at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:346)
    at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:303)
    at org.jruby.runtime.Block.yield(Block.java:194)
    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)
    at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:115)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:122)
    at org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)
    at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61)
    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.EnsureNode.interpret(EnsureNode.java:98)
    at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
    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:201)
    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:183)

I use AppEngine JRuby on Rails (SDK version 1.3.3.1) - a problem I encounter often is that after a few requests the server is getting really SLOW, until it dies and throws OutOfMemoryError on the terminal (OSX).

The requests themselves are very lightweight, not more than looking for an entity or saving it, using DataMapper.

On appspot, this problem is not happening.

Is there any way to enlarge the heap space for JRuby?

The exception log:

    Exception in thread "Timer-2" java.lang.OutOfMemoryError: Java heap space
Apr 29, 2010 8:08:22 AM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: Error for /users/close_users
java.lang.OutOfMemoryError: Java heap space
    at org.jruby.RubyHash.internalPut(RubyHash.java:480)
    at org.jruby.RubyHash.internalPut(RubyHash.java:461)
    at org.jruby.RubyHash.fastASet(RubyHash.java:837)
    at org.jruby.RubyArray.makeHash(RubyArray.java:2998)
    at org.jruby.RubyArray.makeHash(RubyArray.java:2992)
    at org.jruby.RubyArray.op_diff(RubyArray.java:3103)
    at org.jruby.RubyArray$i_method_1_0$RUBYINVOKER$op_diff.call(org/jruby/RubyArray$i_method_1_0$RUBYINVOKER$op_diff.gen)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:146)
    at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    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.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:373)
    at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:346)
    at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:303)
    at org.jruby.runtime.Block.yield(Block.java:194)
    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)
    at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:115)
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:122)
    at org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)
    at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61)
    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.EnsureNode.interpret(EnsureNode.java:98)
    at org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
    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:201)
    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:183)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南街女流氓 2024-09-06 16:48:18

设置 -XX:MaxHeapSize-Xmx 虚拟机参数

set -XX:MaxHeapSize and -Xmx vm parameters

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文