Increasing max number of open files for glassfish user on debian
2009-03-25
My glassfish process kept dying with "Too many open files" in the log.
I'm not surprised that it has too many - it has quite a few large applications running - but how to increase this?
ulimit -n
shows that the user has a default of 1024.
But ulimit -n 2048
gives -su: ulimit: open files: cannot modify limit: Operation not permitted
Some digging leads to /etc/security/limits.conf
Here we added:
glassfish hard nofile 2048
glassfish soft nofile 2048
However - even after logging in and out glassfish still had 1024 and no right to change.
The issue here is that I'm using su to change to the glassfish user. And the pam config for su doesn't pay this limits.conf file any attention until you tell it to.
In /etc/pam.d/su
uncomment the line
session required pam_limits.so
Log out and in to glassfish and finally ulimit -n
shows 2048.