我在拥有4GB RAM和2个CPU的Debian 9 VPS服务器上进行了干净的安装。
安装成功,但当我配置任何MAVEN项目时(在Java 8上),我会得到以下错误:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at jenkins.maven3.agent.Maven35Main.main(Maven35Main.java:137)
at jenkins.maven3.agent.Maven35Main.main(Maven35Main.java:65)
Caused by: java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:717)
at hudson.remoting.AtmostOneThreadExecutor.execute(AtmostOneThreadExecutor.java:95)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at hudson.remoting.RemoteInvocationHandler$Unexporter.watch(RemoteInvocationHandler.java:826)
at hudson.remoting.RemoteInvocationHandler$Unexporter.access$100(RemoteInvocationHandler.java:409)
at hudson.remoting.RemoteInvocationHandler.wrap(RemoteInvocationHandler.java:166)
at hudson.remoting.Channel.<init>(Channel.java:582)
at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:360)
at hudson.remoting.Launcher.main(Launcher.java:770)
at hudson.remoting.Launcher.main(Launcher.java:751)
at hudson.remoting.Launcher.main(Launcher.java:742)
at hudson.remoting.Launcher.main(Launcher.java:738)
... 6 more
Finished: FAILURE
我进行了一些更改,但是没有效果。
尝试1(无效):Ulimit 配置
查看您系统的当前限制,请以运行 Jenkins 的用户(通常为jenkins)在命令行中运行ulimit -a。
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 30
file size (blocks, -f) unlimited
pending signals (-i) 30654
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 99
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 1024
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
在 /etc/security/limits.conf 中增加以下行,以增加限制:
jenkins soft nofile 4096
jenkins hard nofile 8192
jenkins soft nproc 30654
jenkins hard nproc 30654
同样的错误
尝试2(无效):MAVEN_OPTS
向Maven配置添加一些选项。
-Xmx256m -Xss228k
出现相同错误
尝试3 (无效):默认任务最大值
更新默认任务最大值
nano /etc/systemd/system.conf
将下一行内容放入文件中。
DefaultTasksMax=10000
重新启动系统。
遇到相同的错误
尝试在Debian上使用CI环境让我感到沮丧。
有什么建议吗?我甚至可以接受一个类似于Jenkins的新CI服务器。