2

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?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
nadermx
  • 2,596
  • 7
  • 31
  • 66
  • Possibly [minfds](http://stackoverflow.com/questions/27933477/supervisor-open-file-limit-wont-change-when-using-chef) setting? – Mark Mar 09 '16 at 22:12
  • @Mark referring to supervisor setting? Hadn't thought of thought, will try – nadermx Mar 10 '16 at 16:32
  • I went ahead and updated the supervisor conf to put that in but when I check the files for the process still doesnt show updated amount – nadermx Mar 10 '16 at 16:52
  • @Mark that ended up working if you want to post a solution so I can credit you – nadermx Mar 10 '16 at 23:17
  • Thanks @nadermx, just glad your issue is solved, go ahead and answer if you like. Sounds like there was a bit more going on there than just the setting change. – Mark Mar 11 '16 at 09:59

3 Answers3

3

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.

nadermx
  • 2,596
  • 7
  • 31
  • 66
0

This might help you

mkdir -p /etc/systemd/system/supervisord.service.d
cat >/etc/systemd/system/supervisord.service.d/supervisord.conf<<EOF
[Service]
LimitNOFILE=65535
LimitNPROC=65535
EOF

systemctl daemon-reload
systemctl restart supervisord
0

In /etc/supervisor/supervisord.conf file, following parameter needs to be added:

minfds = 2048 (in my case it was 2048, you may set this as per your requirement)

How supervisord.conf file looks after adding the parameter

It is because supervisor set's its own file limit on the program. You have to use minfds setting in supervisor. To check to see if it is working you can run a cat /proc/$PID/limits command.

More details about minfds here: http://supervisord.org/configuration.html#supervisord-section-values