Openfire & Ubuntu & more than 1000 XMPP users

Openfire on Ubuntu may get into a state where it doesn’t accept incoming connections anymore. The process is still there, the log files do not give any hints, but new XMPP clients just hang at the connection attempt.

The reason for this behaviour may be a limit on a user’s maximum number of file descriptors. On Ubuntu, it defaults to 1024 (check with ulimit -n). To lift this limit, edit /etc/security/limits.conf and add the lines:

root		soft	nofile		100000
root        	hard    nofile          100000

to raise the limit to 100K file descriptors and restart openfire. Since you are running the openfire init script as root, the limits need to be applied to root. Even though the process is started as user openfire, the ulimit from the parent process (run as root) seems to get inherited.

Update:┬áThis does not work when openfire is started at boot through an init.d script. The limits.conf is only applied by a PAM module at login. Modify the init script to include “ulimit -n 100000”. This does not need limits.conf since the init scripts are run as root.