Score:0

Wildfly : Too many open files

om flag
Ror

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.

Score:2
in flag

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

Ror avatar
om flag
Ror
This solution seems to increase the open files limit but is there any way to verify that my wildfly server uses this configuration ?
Romeo Ninov avatar
in flag
If your app server run as user `wildfly` it will use it. You need only to logout, then login and restart the server
Ror avatar
om flag
Ror
I'm a bit confused by the login/logout part since the wildfly user is a loginless user ?
Romeo Ninov avatar
in flag
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).
Ror avatar
om flag
Ror
Ok I get it now thanks !
Score:0
mn flag

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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.