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

Matthew Wang
2020-09-15 23:09

Troubleshoot the "Unable to create Native Thread" JVM error 

Affected Versions


You may encounter the following error in your logs:
 java.lang.OutOfMemoryError: unable to create new native thread

Some items need to be reviewed to solve this problem.


How to resolve the error:

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

*               hard    nofile          65535
*               soft    nofile          65535
*               hard    noproc          unlimited
*               soft    noproc         unlimited

**In SUSE Linux, you will also need to set the "DefaultTasksMax=65535" in the /etc/systemd/system.conf, and restart the machine.

-Increase system max threads:
echo 100000 > /proc/sys/kernel/threads-max