This page last changed on Feb 16, 2007 by ivan@atlassian.com.

When system performance on Linux is affected by using too many file descriptors, usually an error can be seen in the log file '(Too many open files)'. Although this affects the entire system, it is a fairly common problem.

Confluence 2.3 was released and the issue with using too many file handles was resolved via utilisation of compound indexing.

To obtain the current maximum number of file descriptors, use 'cat /proc/sys/fs/file-max'. For comparison, an out-the-box ubuntu system has file-max set to 205290.

Increase Total File Descriptors For System

To prevent Confluence from running out of filehandles you need to make sure that there are enough file handles available at the system level, and that the user you are running Confluence as is allowed to use enough file handles:

Run the command sysctl -a. If this is less than 200000, increase the number of file handles by editing /etc/sysctl.conf and changing the property fs.file-max to 200000. If there isn't a value set already for this property, you need to add the line fs.file-max=200000.

Then run sysctl -p to apply your changes to your system.

Increase Total File Descriptors For User

Linux also limits the number of files that can be open per login shell. To change this limit for the user that runs the Confluence service you will need to adjust the user limit configuration.

For PAM enabled systems

For Linux systems running PAM you will need to adjust /etc/security/limits.conf

The format of this file is <username> <limit type> <item> <value>.

For example to set the limit for the user confservice the following line would be used:

confservice hard nofile 5000

Other systems

For other Linux systems the file responsible for setting limits is /etc/limits

To replicate the setting given in the previous example the line would be:

confservice N 5000

To Count Total File Descriptors Used By Confluence

To get the total number of handles that are used by Confluence:

  1. Locate the Confluence ProcId by identifying the Java process with{{'ps axwwwu | grep java'}}
  2. Either run ls -la /proc/<pid>/fd, or use the lsof (LiSt Open Files) command lsof -p <pid of Confluence process>. For a Confluence ProcID of 460, use:
    $ lsof -p 460 | wc -l

When getting support for this error

If you are encountering the Too many open files error within Confluence and this advice does not help, please accompany any support request with the output of lsof -p <PID of Confluence process>, taken at the time of the error, so that the support engineer can determine precisely which file descriptors are being held open.

To address this issue we have modifed the bonnie.jar to switch the indexing to use compound index that uses less file handles. Please see CONF-7401 for details. To use this patched jar please follow the following steps:

1. Download the patched jar file bonnie-2006.03.30-patched.jar
2. Shut down your server.
3. Copy the jar file into your <Confluence-Install>/WEB-INF/lib directory. Note: Ensure that there is only one bonnie jar in this directory.
4. Delete the <Confluence-Home>/index directory.
5. Restart your server
6. Rebuild the index manually

Alternatively, please upgrade your instance to Confluence 2.3 via following these instructions.


bonnie-2006.03.30-patched.jar (application/java-archive)
Document generated by Confluence on Oct 10, 2007 18:37