4

I do a clean install on my Debian 9 VPS Server with 4GB RAM and 2 CPUs.

The installation is sucessfull but when I configure any MAVEN project, (On Java 8) I get the following error:

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

I did some changes but nothing works.


Try 1 (Not Working): Ulimit Configuration

See the current limits of your system, run ulimit -a on the command-line with the user running Jenkins (usually jenkins).

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

Increaseasing limits, adding these lines to /etc/security/limits.conf:

jenkins      soft   nofile  4096
jenkins      hard   nofile  8192
jenkins      soft   nproc   30654        
jenkins      hard   nproc   30654

Get The Same Error


Try 2 (Not Working): MAVEN_OPTS

Adding some Options to maven configuration.

-Xmx256m -Xss228k

Get The Same Error


Try 3 (Not Working): Default Task Max

Update Default Task Max

nano /etc/systemd/system.conf

Put the next line into the file

DefaultTasksMax=10000

Reboot the system.

Get The Same Error


I am getting frustrated trying to use an CI Environment on Debian.

Any suggestions? I accept even a new CI server that works similar to jenkins.

vvvvv
  • 25,404
  • 19
  • 49
  • 81
  • Please do not edit solution announcements into the question. Accept (i.e. click the "tick" next to it) one of the existing answer, if there are any. You can also create your own answer, and even accept it, if your solution is not yet covered by an existing answer. Compare https://stackoverflow.com/help/self-answer – Yunnosch Apr 03 '22 at 09:07

1 Answers1

0

Reduce the Thread Stack size.

Access to the configuration Jenkins File at:

nano /etc/default/jenkins

Changing the JAVA_ARGS on deploy:

JAVA_ARGS="-Xmx3584m -XX:MaxPermSize=512m -Xms128m -Xss256k -Djava.awt.headless=true"

(For 4Gb RAM)

Reboot the Jenkins Service:

systemctl restart jenkins

Note: per OP @JPMG Developer's own edit to the question.

vvvvv
  • 25,404
  • 19
  • 49
  • 81