How do I fix Out of Memory Unable to Create Native thread error?

Matthew Wang
2021-03-18 20:21

Relevant versions: This information pertains to Artifactory version 6.x and 7.x.

If you encounter the following error in your logs:

java.lang.OutOfMemoryError: unable to create new native thread

you'll need to review several items to solve this problem.

First, increase the number of max open files or processes in /etc/security/limits.conf, and restart the application. For example:

*               hard    nofile          65535
*               soft    nofile          65535
*               hard    nproc          unlimited
*               soft    nproc         unlimited

Note: In SUSE Linux, you'll also need to set the DefaultTasksMax=65535 in /etc/systemd/system.conf, and restart your machine.

Next, increase your system max threads:

echo 100000 > /proc/sys/kernel/threads-max

More information about troubleshooting this issue is available HERE, HERE, and HERE.