(File.Error) could not get current working directory nil: too many open files

Hello.

(File.Error) could not get current working directory nil: too many open files.

Has anyone seen this error? I got this error when I send a request to phoenix server. I don’t have enough clue of that…
I’d like to find a hint. :cry: :cry: :cry:

Fix for Linux

http://woshub.com/too-many-open-files-error-linux/

Fix for MAC OS

3 Likes

Following the website, I have changed /etc/sysctl.conf.

kern.maxfiles=204800
kern.maxfilesperproc=180000

and additionally, I changed /Library/LaunchDaemons/limit.maxfiles.plist.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>limit.maxfiles</string>
    <key>ProgramArguments</key>
    <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>maxfiles</string>
      <string>524288</string>
      <string>524288</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>ServiceIPC</key>
    <false/>
  </dict>
</plist>

after adding those changes, I tried to run my phoenix server. But it does not work…
Has anyone got same error? I’d like to know a solution :cry:

My laptop is MacOS.

it solved with setting this command.

ulimit -S -n 2048 # or whatever number you choose

thank you.

2 Likes