limits.conf and daemons on Ubuntu

I recently was setting up a couple ElasticSearch and RabbitMQ instances when I noticed RabbitMQ was still reporting an abysmally low fd limit in its log file at startup. I double checked my /etc/security/limits.conf and sure enough, limits were properly set to 64000. Yet for some reason it was still only seeing a max of 1024.

It turns out that in Ubuntu 10.04, /etc/pam.d/common-session{,-noninteractive} does not contain:

session required

Adding that, solved my issue:

=INFO REPORT==== 1-Feb-2012::00:05:47 ===
Limiting to approx 63900 file handles (57508 sockets)

UPDATE (Wed Apr 18 15:01:17 PDT 2012)
For RabbitMQ 2.8.x, the init script uses start-stop-daemon. Apply this patch:

--- /etc/init.d/rabbitmq-server.old	2012-04-18 21:54:05.852307662 +0000
+++ /etc/init.d/rabbitmq-server	2012-04-18 21:49:17.594182809 +0000
@@ -35,6 +35,8 @@
 set -e
+[ -r /etc/default/${NAME} ] && . /etc/default/${NAME}
 ensure_pid_dir () {
     PID_DIR=`dirname ${PID_FILE}`
     if [ ! -d ${PID_DIR} ] ; then

And then in /etc/default/rabbitmq-server

ulimit -n 65000

  • patilla

    Hi, I also have the same problem.
    I had ‘session required’ in my /etc/pam.d/common-session{,-noninteractive}  filesand yet still doesn’t work for me…My /etc/security/limits.conf file is correct… In a cloned system it is working, there is a strange behavior though, when running ‘ulimit -n’ it returns 1024 in both machines, but when I edit limits.conf on one works and on the other one I can’t make it work. I see the values with the management plugin.I have checked everything!Any ideas?Thanks.

    • John Watson

      Sorry, I can’t think of why the 2 machines would behave differently.
      Perhaps versions are different?

      But that’s my best guess =

      • patilla

        Well, I also took a look. Versions are not the same. Old machine is 2.7.1, new one is 2.8.1

        I will try to get the old version and install it in the new machine.Wish me luck!
        I will tell you what I shall figure out.

        • John Watson

          Updated the post with the fix for 2.8.1

          • patilla


            I also got this from the rabbitmq mail list.I was just testing it. No need for this, at least on the brand new machine I have configured, even though it is version 2.8.1

            Thanks John!