Too many open files Error resolution

  

Too many open files Errors are common faults in Linux systems. Solutions can be easily found on the network. Linux system configuration file restrictions for open files table. If the configuration value is exceeded, Will reject requests for other file operations and throw Too many open files exceptions. This limitation is divided between system level and user level. I also encountered this problem at work, so I kept it under the blog record.

First, the error screenshot:

The picture shows the error log of resin, it is obvious that Too many open files:


Second, temporary solution Br>

The temporary solution is very simple, first execute ulimit -n 65535, then restart resin.

Ps: Please note whether the startup environment is effective: switch to the startup identity of resin, execute ulimit -n to see if the current maximum number of file openes has been optimized.

Three, permanent effect

Method one:

You can talk about ulimit -n 65535 Add to the end of /etc/profile;
BASICecho "ulimit - n 65535" >>/etc/profile

#Refresh configuration
BASICsource /etc/profile

Method 2:

Modify the /etc/security/limits.conf file at the end Add the following:

* soft noproc 65535

* hard noproc 65535

* soft nofile 65535

* hard nofile 65535

Or directly execute the following code:

echo '* soft noproc 65535

* hard noproc 65535

* soft nofile 65535

* hard Nofile 65535'>>/etc/security/limits.conf

Using method one, when logging in to a normal account, it will report no permission error, so it is recommended to use method two. It should be noted that no matter which method is used, the application needs to be restarted after the modification takes effect, otherwise the program will continue to use the old environment settings.

Copyright © Windows knowledge All Rights Reserved