1

I am running into this error on an Ubuntu Machine while performing a GET operation in the Request module and writing to a MongoHQ store.

My error is this:

{ [Error: connect EMFILE] stack: 'Error: connect EMFILE\n at exports._errnoException (util.js:682:11)\n at connect (net.js:813:19)\n at net.js:897:9\n at Object.asyncCallback [as callback] (dns.js:78:16)\n at Object.onlookup [as oncomplete] (dns.js:94:10)', code: 'EMFILE', errno: 'EMFILE', syscall: 'connect' }

I have seen this solution:

How do I change the number of open files limit in Linux?

And I followed the prescribed solution by modifying my ulimit values so that my output of ulimit -a is:

4096

I also changed my limits.conf file from this link:

https://askubuntu.com/questions/162229/how-do-i-increase-the-open-files-limit-for-a-non-root-user

I added these lines:

  • soft nofile 4096
  • hard nofile 4096

and I still have the same issue.

However I do have another ubuntu box with less memory and storage running (also) on an Amazon EC2 instance that does not have this issue. I did not make any changes to this box, the only difference is that it is running Precise 12.04.2 LTS while my problem machine is running Precise 12.04.3 LTS.

Any help would be greatly appreciated.

Community
  • 1
  • 1
MonsterWimp757
  • 1,197
  • 2
  • 14
  • 29

1 Answers1

0

I believe you are one the right track. I also had an EMFILE error and what ultimately fixed it was adding these lines to my /etc/security/limits.conf

*                soft    nofile          100000
*                hard    nofile          1000000
root             soft    nofile          100000
root             hard    nofile          1000000

I then rebooted and I no longer had the issue. The '*' means all non-root users, so this is basically a catch all, no matter what user is running this program. From what I can tell, the ulimit does not get changed until after the user logs back in, so you might have to kill the process and logout, and then log back in....this could by why rebooting worked for me!

Big Sam
  • 1,290
  • 14
  • 7