Nexus fails to start with java.lang.OutOfMemoryError: unable to create new native thread

In earlier versions of Nexus there was one thread spawned per repository. The default per user process limit in Linux is 1024.  So if you have a large number or repositories you can hit this limit.

As a short term workaround you can try adding the following to /etc/security/limits.conf (where "nexus" is the user ID of the user running Nexus):

#<domain>      <type>  <item>         <value>
nexus          hard    nproc          2048
nexus          soft    nproc          2048

Upgrading to Nexus 2.4 or later will provide a better solution though, since these per-repository threads no longer exist.

Note:  Sometimes this problem can occur if another process on the system (not Nexus) is consuming so many process ID's that Nexus cannot spawn new threads.   To check for this, first find the system wide limit.

You can do this with:

cat /proc/sys/kernel/pid_max

Then run this to find out the total number of threads/processes on the system:

ps -eLf |wc -l

Have more questions? Submit a request


Article is closed for comments.
Powered by Zendesk