Child pages
  • I'm getting too many open files error

Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

"IOException: Too many open files" indicates a problem where a process has so many open file handles that it's hitting the maximum imposed by the operating system. This is normally caused by someone opening a file but forgetting to close it, commonly referred to as a "file descriptor leak."

Is that a Jenkins bug?

Many users confuse "too many open files" error reported by from their builds as a problem in Jenkins. So make sure the exception you are seeing is coming from Jenkins, and not from tools like Ant or Maven that you run inside Jenkins. You can check this by looking at the stack trace.

Diagnosis

For us to fix this problem, we need to know where the leak is occurring. And to this, we need to know what files the process currently opens.

  • Install File Leak Detector Plugin and get the list of open files.
  • On Linux systems, check "ls -la /proc/PID/fd" which gives you the list.
  • On other Unix systems, check "lsof -p PID"
  • On Windows, use Process Explorer to obtain the list.

Once you obtained this information, force a GC by visiting http://yourserver/jenkins/gc, and obtain the list again. If the list shrinks substantially, it suggests that open file handles were pending garbage collection.

Please open a ticket in the issue tracker with all the information (or if you think one of the existing "too many open files" issue shows the same kind of leak, attach your info there.)

Workaround

While we work on the problem, you can often work around the problem as follows:

  • Increase the maximum number of files that can be opened simultaneously. How you do this depends on a platform. (for example on Linux it's in /etc/security/limits.conf.)
  • Sometimes forcing a GC regularly would keep things working.
  • No labels