我在jruby 1.7.4下运行rake assets:precompile
时遇到了PermGen空间错误。我试过增加MaxPermSize和turning on ClassUnloading,但没有用。
这在Cloudbees m1-large实例和我的macbook pro本地都可靠地发生。
$ MAVEN_OPTS='-XX:MaxPermSize=2048M -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -w' bundle exec rake dash:build RAILS_ENV=production --trace
** Invoke environment (first_time)
** Execute environment
** Invoke dash:build (first_time)
** Invoke dash:prebuild (first_time)
** Execute dash:prebuild
** Invoke assets:clean (first_time)
** Execute assets:clean
** Invoke assets:clean:all (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:clean:all
rm -rf /Users/andrew/code/unified_dashboard/public/assets
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment
** Invoke tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
PermGen space
org.jruby.java.proxies.JavaProxy.confirmCachedProxy(JavaProxy.java:503)
org.jruby.java.proxies.JavaProxy.getSingletonClass(JavaProxy.java:495)
org.jruby.RubyModule.extend_object(RubyModule.java:2008)
org.jruby.RubyModule$INVOKER$i$1$0$extend_object.call(RubyModule$INVOKER$i$1$0$extend_object.gen)
org.jruby.RubyClass.finvoke(RubyClass.java:741)
org.jruby.runtime.Helpers.invoke(Helpers.java:477)
org.jruby.RubyBasicObject.callMethod(RubyBasicObject.java:359)
org.jruby.RubyBasicObject.extend(RubyBasicObject.java:2756)
org.jruby.RubyKernel.extend(RubyKernel.java:2187)
org.jruby.RubyKernel$INVOKER$s$0$0$extend.call(RubyKernel$INVOKER$s$0$0$extend.gen)
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:662)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:205)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
org.jruby.ast.IfNode.interpret(IfNode.java:118)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:225)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:202)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
org.jruby.ast.FCallTwoArgNode.interpret(FCallTwoArgNode.java:38)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.ast.RescueBodyNode.interpret(RescueBodyNode.java:108)
org.jruby.ast.RescueNode.handleJavaException(RescueNode.java:205)
org.jruby.ast.RescueNode.interpret(RescueNode.java:138)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:225)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:202)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:346)
据我所知,该项目的资产没有做任何异常。我对Java或Jruby不是很熟悉(当维护者退出时我继承了这个项目)所以我已经没有想要调查的东西了。我一定会感激一些帮助!
答案 0 :(得分:3)
您正在设置MAVEN_OPTS
,但您没有执行Maven,因此没有什么可以关心该环境变量。您最终尝试设置JVM选项,在这种情况下最简单的方法是通过JRUBY_OPTS
:
$ JRUBY_OPTS='-J-XX:MaxPermSize=1G' ruby -e 'puts java.lang.management.ManagementFactory.getMemoryPoolMXBeans.map {|p| "#{p.name}: #{p.usage.max}"}'
PS Perm Gen: 1073741824
$ JRUBY_OPTS='-J-XX:MaxPermSize=2G' ruby -e 'puts java.lang.management.ManagementFactory.getMemoryPoolMXBeans.map {|p| "#{p.name}: #{p.usage.max}"}'
PS Perm Gen: 2147483648