在jruby 1.7.4下运行rake assets:precompile
时出现PermGen空间错误。我尝试增加MaxPermSize和turning on ClassUnloading,但无济于事。
无论是在Cloudbees m1大型实例上还是在我的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不太熟悉(当维护人员退出时,我继承了该项目),因此我没有足够的想法来进行调查。我一定会感谢您的帮助!
最佳答案
您正在设置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