gpt4 book ai didi

java - "PermGen space"运行 Assets :precompile under jruby

转载 作者:行者123 更新时间:2023-11-29 05:29:11 26 4
gpt4 key购买 nike

在 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)

据我所知,该项目没有对其 Assets 进行任何异常处理。我对 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

关于java - "PermGen space"运行 Assets :precompile under jruby,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21714639/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com