18

when i open Lutris and then LOL client , this happening. And game never work good. I tried many things but never can change the open file limit. How can fix this ?

Waiting on children  
Waiting on children  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  
esync: write: Bad file descriptor  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  
esync: write: Bad file descriptor  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  
eventfd: Too many open files  

also there is my limits info

~$ ulimit -a  
core file size          (blocks, -c) 0  
data seg size           (kbytes, -d) unlimited  
scheduling priority             (-e) 0  
file size               (blocks, -f) unlimited  
pending signals                 (-i) 15106  
max locked memory       (kbytes, -l) 16384  
max memory size         (kbytes, -m) unlimited  
open files                      (-n) 1024  
pipe size            (512 bytes, -p) 8  
POSIX message queues     (bytes, -q) 819200  
real-time priority              (-r) 0  
stack size              (kbytes, -s) 8192  
cpu time               (seconds, -t) unlimited  
max user processes              (-u) 15106  
virtual memory          (kbytes, -v) unlimited  
file locks                      (-x) unlimited  
4

3 Answers 3

18

When the "Too Many Open Files" error message is written to the logs, it indicates that all available file handles for the process have been used (this includes sockets as well).

In a majority of cases, this is the result of file handles being leaked by some part of the application. ulimit is a command in Unix/Linux which allows to set system limits for all properties. In your case, you need to increase the maximum number of open files to a large number (e.g. 1000000):

ulimit -n 1000000

or

sysctl -w fs.file-max=1000000

and /etc/security/limits.conf or /etc/sysctl.conf change:

fs.file-max = 1000000

To determine if the number of open files is growing over a period of time, issue lsof to report the open files against a PID on a periodic basis. For example:

lsof -p [PID] -r [interval in seconds, 1800 for 30 minutes] > lsof.out

This is especially useful if you don't have access to the lsof command:

ls -al /proc/PID/fd

Guidelines for setting ulimits

2

Run

less /proc/PID/limits

to check the actual Soft Limit of Max open files. If you set up ulimits but the actual number is still low - review how you launch the process. E.g., systemd takes over the ulimits, and you should use explicit settings, better at the process level, to ensure your program gets the runtime limits it needs.

0

I think, there are different cases why this might happen:

  1. System wide limit (Run cat /proc/sys/fs/file-max to see the limit, for me it's 9223372036854775807)
  2. Max user instances (Run cat /proc/sys/fs/inotify/max_user_instances: used to be 128)
  3. Hard user limit (Run ulimit -nH: 1048576)
  4. Soft user limit (Run ulimit -nS: used to be 1024)

1. System wide limit

The system wide rule can be adjusted by putting

fs.file-max = 9223372036854775807

into /etc/sysctl.conf. This value was no issue for me.

2. Max user instances

For me, this value was too low. To fix it, add or edit this line again in /etc/sysctl.conf

fs.inotify.max_user_instances = 1024

3. & 4. Hard or soft user limit

My soft user limit was too low, too. To fix that, open /etc/security/limits.conf (as root) and add this line:

<username>             soft    nofile 100000

(Replace <username> with your username, or * for all users)

The hard user limit can be set by replacing soft with hard in the line above. Of course, you can have multiple rules for hard & soft limit or different users.

Putting things into effect

Maybe a logout and logging back in is enough for the changes to be picked up, but I just restarted the system to be sure.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .