Java. lang. OutOfMemoryError: unable to create new native thread, createnativethread
Symptom:
SuperMap iServer is deployed in Tomcat (8.5.13), and the number of concurrent users is around 100. After the system runs for a period of time, the Service crashes. Exception prompt
Problem Analysis:
1. When the prompt information in the log is displayed, the system memory is insufficient. Therefore, a monitoring script (such as) is added to the server to record the system memory and tomcat memory every 1 s.
After monitoring for a period of time, an exception occurs again. No Memory exception found from the log
2. After the memory is exceeded, is it because of the large number of concurrent users that the number of processes exceeds?
1) view the resource limit parameter ulimit-a of the current linux User
2) among the above parameters, the most important concern is the maximum number of files that a process can open, that is, open files. The maximum number of processes allowed to be created is the max user processes parameter. We can use ulimit-u 4096 to modify the value of max user processes, but it only takes effect in the session of the current terminal. After logon, the default value is still used.
The correct modification method is to modify the value in the/etc/security/limits. d/90-nproc.conf file. Let's take a look at what this file contains:
$ cat /etc/security/limits.d/90-nproc.conf # Default limit for number of user's processes to prevent# accidental fork bombs.# See rhbz #432903 for reasoning.* soft nproc 4096
You only need to modify the value 4096 in the above file.
After investigation, it is indeed because the maximum number of processes set by the current user on the server is too small, leading to the failure of Process Creation and crash.
Reference: http://www.linuxidc.com/Linux/2011-03/33121.htm
Http://www.cnblogs.com/billyxp/archive/2013/04/03/2998079.html
Linux view current process: http:// OS .51cto.com/art/201101/244090.htm
Http://www.linuxidc.com/Linux/2015-01/111270.htm