Search code examples
goubuntu-14.04supervisord

Increase open files limit for process


When I run ulimit -n I get 100000 as the value.

I have edited the Added following lines in /etc/security/limits.conf

*     soft    nofile          100000
*     hard    nofile          100000

I have also edited the pan_limits

But I am currently running a go program that keeps throwing out the error

2016/03/09 21:42:27 http: Accept error: accept tcp [::]:3000: accept4: too many open files; retrying in 5ms
2016/03/09 21:42:27 getAudioOnlyInfo: open /dev/null: too many open files

The issue is that when I actually check to see the limits set on the actual process by running cat /proc/1480/limits I see this

Max open files            1024                 4096                 files   

I'm running a golang program through supervisor is there a reason it wouldn't be reading the system limits?


Solution

  • After trying to resolve this issue in multiple questions, got it down to the fact that supervisor set's its own file limit on the program. As seen in the comments, you have to use minfds setting in supervisor.

    To check to see if it is working you can run a cat /proc/$PID/limits

    Which should output the number you set minfds too, in my case 100,000

    Max open files            100000               100000               files     
    

    I would like to note that when you go and put into supervisor the minfds you put it in the /etc/supervisor/supervisord.conf as if you put in your programs config file it will do nothing.