1

We recently got a "too many open files" error in our production Wildfly 17 on debian 9. A simple restart of the wildfly service got rid of the error but I'd like to avoid the problem to come back. I'd like to increase the limit but I'm not sure what I should change and how can i know the configuration as been taken into account.

I checked the ulimit for the loginless wildfly user :

    sudo su - wildfly -c 'ulimit -a' -s '/bin/bash'
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 117724
max locked memory       (kbytes, -l) 64
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) 117724
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

The limit seems to be set at 1024 for the user. However I can check the number of open files by my wildfly processes and I have this :

sudo ls -l /proc/PID/fd |wc -l
1296

Which is bigger than the limit and I'm not getting any error right now. Is there a way to set the limit higher permanently ? Maybe in the wildfly configuration files ? I'm a bit lost.

Ror
  • 321
  • 3
  • 16

2 Answers2

2

You need to edit/add records in /etc/security/limits.conf. For example one records for user wildfly and number of open files may looks like:

wildfly  soft    nofile          16384
wildfly  hard    nofile          16384

This set number of open files for the user to 16384

P.S. You should logout and then login (as user wildfly) to make this in work

Romeo Ninov
  • 5,263
  • 4
  • 20
  • 26
  • This solution seems to increase the open files limit but is there any way to verify that my wildfly server uses this configuration ? – Ror Mar 28 '22 at 12:29
  • If your app server run as user `wildfly` it will use it. You need only to logout, then login and restart the server – Romeo Ninov Mar 28 '22 at 12:34
  • I'm a bit confused by the login/logout part since the wildfly user is a loginless user ? – Ror Mar 28 '22 at 12:40
  • you use `sudo`. so just change the numbers and with `sudo` stop and start the server. The idea is these parameters are set during login process (or sudo execution). – Romeo Ninov Mar 28 '22 at 12:44
  • 1
    Ok I get it now thanks ! – Ror Mar 28 '22 at 12:54
0

cat /proc/ 'pid' /limits | grep files will show you the value of the max open files specific for the wildfly process.

lsof -a -p 'pid' | wc -l will show the current number of open files for the specific pid