SAP Knowledge Base Article - Public

3600978 - Error on Tomcat "java.io.IOException: Too many open files"

Symptom

  • You can see the following error in your Catalina logs: java.io.IOException: Too many open files;
  • Your Agent/Tomcat URL becomes inaccessible: <tomcat_host:port> and tomcat_host:port/C4A_AGENT/deploymentInfo
  • Restarting your Tomcat solves the issue.

Environment

  • Apache Tomcat 9
  • SAP Cloud Agent

Reproducing the Issue

The issue happens whenever Tomcat tries to open more files than defined by the ulimit parameter.

Cause

The ulimit parameter on Linux machines is used to control the system's resource limits for processes running on the machine. It specifies the maximum resources that a user or process can use, which helps prevent a single process from consuming all the system's resources and potentially causing instability.

Resolution

To resolve this error, you need to increase the file descriptor limits (the ulimit parameter) on your Linux system. This will allow Tomcat to open more files simultaneously, which can help avoid the error you're seeing.

To do this, you can set a higher ulimit value for the entire Linux system by editing the /etc/security/limits.conf file. 

Alternatively, you can edit the ulimit for the Tomcat service user only. This approach is ideal if you want to avoid changing system-wide settings. You can do this by editing the Tomcat systemd service configuration file:

  1. Usually located in /etc/systemd/system/ or /lib/systemd/system/: sudo nano /etc/systemd/system/tomcat.service;
  2. Under the Service section, add: LimitNOFILE=65536;
  3. Reload systemd to apply the changes: sudo systemctl daemon-reload;
  4. Restart Tomcat: sudo systemctl restart tomcat.

ulimit - How do I increase the open files limit for a non-root user? - Ask Ubuntu

** Important caveats: **

  • The ulimit parameter is only applicable to Linux Operational Systems;
  • The steps described here are based on generic file locations. Your system may have the files in different directories. Adapt the commands accordingly.

See Also

Your feedback is important to help us improve our knowledge base.

Keywords

linux, ulimit, java, exception, files, limit, error, tomcat, agent, inaccessible, unreachable, url, C4A_AGENT, deploymentInfo, cloud, restart, boot. , KBA , LOD-ANA-AQU , Import Data Connections (Acquiring Data) , Known Error

Product

SAP Analytics Cloud 1.0