Bamboo 中的 Java 堆大小错误
Posted
技术标签:
【中文标题】Bamboo 中的 Java 堆大小错误【英文标题】:Java Heap Size Error In Bamboo 【发布时间】:2015-01-15 13:46:12 【问题描述】:在使用 maven 在竹子中构建项目时,出现内存不足异常。但是,项目是在本地环境中正确构建的。试图在 maven-opts 中增加堆大小,但没有运气。下面是堆栈跟踪:
com.atlassian.bamboo.repository.RepositoryException: java.lang.OutOfMemoryError: Java heap space
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:371)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:259)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:161)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectAllChangesSinceLastBuild(DefaultChangeDetectionManager.java:127)
at com.atlassian.bamboo.v2.trigger.ManualBuildDetectionAction.performDelayedChangeDetection(ManualBuildDetectionAction.java:173)
at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$2.getChainState(ChainExecutionManagerImpl.java:209)
at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:262)
at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:198)
at sun.reflect.GeneratedMethodAccessor16764.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy98.delayedStart(Unknown Source)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:383)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:378)
at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:312)
at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:81)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:725)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$200(PlanExecutionManagerImpl.java:123)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1.run(PlanExecutionManagerImpl.java:377)
at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:55)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.OutOfMemoryError: Java heap space
【问题讨论】:
你检查过confluence.atlassian.com/display/BAMKB/… 是的,也修改了 maven_opts,但没有运气。 【参考方案1】:在您构建的完整日志中,您应该能够看到如下内容:
Picked up _JAVA_OPTIONS: -Xms128m -Xmx2048m
在 Bamboo Maven 任务中,有一个文本框 Environment variables
以作为描述:
额外的环境变量。例如
MAVEN_OPTS="-Xmx256m -Xms128m"
。您可以添加多个参数,以空格分隔。
那里,你可以设置_JAVA_OPTIONS
的情况:
_JAVA_OPTIONS="-Xms256m -Xmx4096m"
【讨论】:
以上是关于Bamboo 中的 Java 堆大小错误的主要内容,如果未能解决你的问题,请参考以下文章
groovy --不注意的小错误(java.lang.String.positive() is applicable)
JavaScript中易犯的小错误-------常见错误五:低效的DOM操作
C 代码中的一个小错误,用于在不使用 * 运算符的情况下将 2 位二进制数相乘