I am setting up a jenkins instance on a VServer with 2GB RAM and nothing else running (usage < 200MB) running CentOS 6.7.
When starting a jenkins build on said instance, I always get this error when jenkins runs gradle --debug --stacktrace test
:
19:26:50.727 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.OutOfMemoryError: unable to create new native thread
As this seems to be the case of not allowing to many threads I raised the ulimit to:
[root@xxx]# runuser -s /bin/bash jenkins -c 'ulimit -u'
16384
I also tried out different jenkins JVM memory allocation flags, giving the instance 200MB or 1GB changed nothing, lowering the stack size to allow space for native threads has not helped either.
When I run the same gradle command as root, gradle hangs with a similar error:
19:29:14.939 [QUIET] [system.out] Error occurred during initialization of VM 19:29:14.940 [QUIET] [system.out] java.lang.OutOfMemoryError: unable to create new native thread 19:29:14.941 [QUIET] [system.out] at java.lang.Thread.start0(Native Method) 19:29:14.941 [QUIET] [system.out] at java.lang.Thread.start(Thread.java:714) 19:29:14.942 [QUIET] [system.out] at java.lang.ref.Reference.<clinit>(Reference.java:187)
Is there anything else I can try to fix this?