Jenkins构建抛出内存不足错误 [英] Jenkins build throwing an out of memory error

查看:342
本文介绍了Jenkins构建抛出内存不足错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们让Jenkins在ec2实例上运行.进行构建时,我们会看到以下错误:

We have Jenkins running on an ec2 instance. When doing a build, we see the following error:

17:29:39.149 [INFO] [org.gradle.api.Project] OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000007ac000000, 234881024, 0) failed; error='Cannot allocate memory' (errno=12)
17:29:39.150 [INFO] [org.gradle.api.Project] #

17:29:39.150 [INFO] [org.gradle.api.Project] # There is insufficient memory for the Java Runtime Environment to continue.

17:29:39.150 [INFO] [org.gradle.api.Project] # Native memory allocation (malloc) failed to allocate 234881024 bytes for committing reserved memory.

我对此主题进行了研究,并尝试了各种设置,例如增加堆内存,ram和PermGenSize.这是我在詹金斯上的当前记忆设置:

I researched on this topic and tried various settings such as increasing the heap memory, ram and PermGenSize. Here is my current memory setting on Jenkins:

-Xms256m -Xmx2048m -XX:MaxPermSize=512m

我还有其他遗漏的东西导致OOM吗?

Are there any other things that I'm missing that's causing an OOM?

推荐答案

我已经卖出了同样的问题. (我有ec2,t2.micro,Ubuntu 14,詹金斯,Tomcat,Maven). 默认情况下,您没有交换空间. 要确认这一点:

I've sold the same problem. (I have ec2, t2.micro, Ubuntu 14, Jenkins, Tomcat, Maven). By default you don't have swap space. To confirm this:

free -m

只需添加一些即可.尝试使用1 GB的存储空间.

Just add some. Try with 1 GB for begin.

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

再次检查:

free -m

有关更多详细信息,请参见

For more details look here

这篇关于Jenkins构建抛出内存不足错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆