When running all Kafka tests I had been getting failures most every time.
Usually in the SocketServerTest class. However, when I would run individual
tests, there were no failures. After a bit of digging I found this is due
to the small default open files limit in Mac Yosemite. I am positing how to
increase the limit here in case anyone else has been running into the
issue. Let me know if this helped you too. If it is fairly common we can
put something on the wiki.

*Adjusting Open File Limits in Yosemite:*
Note: You can choose your own limits as appropriate

1. Write the following xml to /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>65536</string>

          <string>65536</string>

        </array>

      <key>RunAtLoad</key>

        <true/>

      <key>ServiceIPC</key>

        <false/>

    </dict>

  </plist>


2. Then write the following to /Library/LaunchDaemons/limit.maxproc.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.maxproc</string>
      <key>ProgramArguments</key>
        <array>
          <string>launchctl</string>
          <string>limit</string>
          <string>maxproc</string>
          <string>2048</string>
          <string>2048</string>
        </array>
      <key>RunAtLoad</key>
        <true />
      <key>ServiceIPC</key>
        <false />
    </dict>
  </plist>


3. Add the following to your bashrc or bashprofile:

ulimit -n 65536

ulimit -u 2048


4. Restart your computer. After restart validate settings by executing:

launchctl limit



*Adjusting Open File Limits in Older Versions of OS X:*
Note: You can choose your own limits as appropriate

1. Add the following command to /etc/launchd.conf:

limit maxfiles 32768 65536


2. Restart your computer. After restart validate settings by executing:

launchctl limit

Reply via email to