"Too many open" errors and solutions

First, the problem phenomenon

java.io.IOException: Too many open files

Enter the appropriate log process, see the tips

Second, Solutions

Thinking: This case involves the use under linux ulimit command, ulimit is mainly used to restrict the use of resources of the process, which supports various types of restrictions.

-a

Display all information about the current system resource limit.

-H

Set hard resource limits, once set can not be increased.

-S

Set the resource limits, after setting can be increased, but can not exceed the hard-resource settings.

-c

The maximum size of core files to blocks as a unit.

-f

Process can create a maximum file with blocks as a unit.

-d

The maximum size of process data segment to Kbytes units.

-m

Maximum memory size in Kbytes units.

-n

The maximum number of file descriptors that can be opened.

-s

Thread stack size in Kbytes units.

-p

The buffer size of the pipe, in units of Kbytes.

-u

The maximum number of processes available to the user.

-v

Maximum number of processes available virtual memory to Kbytes units.

-t

The maximum CPU usage time, in seconds.

-l

The maximum memory size can be locked to Kbytes units.

Profile Ulimit command in /etc/security/ulimit.conf;

The maximum number of processes available to modify user files Ulimit command: /etc/security/ulimit.d/20-nproc.conf

When two files are available to modify the maximum number of user processes prevail /etc/security/ulimit.d/20-nproc.conf.

Third, the cause of the problem

Since adding ulimit time limit is later than the last start tomcat time, and in the meantime, tomcat service has not been restarted, the operating system has not been restarted, then ulimit resource limit for tomcat it is not always in effect.

Resolution process:

[root@tomcatserver~]# pgrep–f tomcat

12031

[root@tomcatserver~]# ps-eopid,lstart,etime|grep12031

12031 Tue Apr 17 14:25:48 2018 47:03

[root@tomcatserver~]# stat /etc/security/limits.conf

We can restart the process

Guess you like

Origin www.cnblogs.com/yxf-/p/11442834.html