记一次 jenkins OutOfMemory 错误

Apr 24, 2018 11:19:48 AM hudson.init.impl.InstallUncaughtExceptionHandler$DefaultUncaughtExceptionHandler uncaughtException
SEVERE: A thread (pool-6-thread-46/72) died unexpectedly due to an uncaught exception, this may leave your Jenkins in a bad way and is usually indicative of a bug in the code.
java.lang.OutOfMemoryError: unable to create new native thread
 
内存溢出异常,无法创建新的本地线程,开始怀疑是jvm虚拟机参数有问题,尝试过修改几次都没有什么效果。
 
后来参考了这篇博文 http://www.cnblogs.com/myshare/p/5177135.html,查看了用户线程限制,修改了下果然就好了。
 
记录下大致过程
 
首先执行 ulimit -u
显示 1024,这个是默认的用户线程数,也就是没有特殊配置
 
执行 pstree -p | wc -l 得到当前用户线程数是217,一般来说不会有问题才对,可是没有别的办法,索性尝试下吧。
 
执行 cd /etc/security/limit.d/,修改下面的配置文件,我这里是 90-nproc.conf,一下是修改后的文件内容
 
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
 
* soft nproc 1024
root soft nproc unlimited
yxgly soft nproc 30654
yxgly hard nproc 30654

猜你喜欢

转载自www.cnblogs.com/bityinjd/p/8984460.html