2

I need to increase ulimit -n on Ubuntu 12.04. It's currently:

open files                      (-n) 1024

(1024 soft, 4096 hard)

In /etc/security/limits.conf I have:

root soft nofile 10240
root hard nofile 10240

In /etc/pam.d/login, /etc/pam.d/common-session, /etc/pam.d/common-session-noninteractive I have

session    required   pam_limits.so

However, ulimit -n keeps resetting to 1024. I need to increase it as I use Node.js / socket.io with forever and the limit is limiting the maximum of concurrent visitors / connections.

apscience
  • 121
  • 1
  • 4

4 Answers4

1

How do you start your program?

Try to wrap the start code for your program with something like this:

/bin/bash -c "ulimit -n 4096; exec /usr/bin/node /PATH_TO/YOUR_PROGRAM.js"
dsmsk80
  • 5,817
  • 18
  • 22
0

Do you have anything like /etc/limits.d/* ? Have you tried turning SELinux off (if you have it turned on)?

David Lakatos
  • 303
  • 1
  • 10
-1

Add ulimit -n 10240 to /root/.bashrc

-1

The same problem exists in Debian 8, when Im running Redis via the init script it came with. Lost 16 hours writing configs & rebooting trying to get past the limit of 1020 connections running as non-root. Im going to run it as root. AFAIK the apache server is working this way: starts as root, sets the process limits & drops the uid to www-data.