Why Tomcat not releasing files [Too many open files error] (oracle APEX -> Tomcat)

  • perf-test.com need your contributions to build up a strong repository of performance engineering resources.

camillelola

New Member
Aug 8, 2018
1
0
0
31
United States
mindmajix.com
I am working as an Oracle developer. Recently I am facing an issue with tomcat where I keep getting "Too many open files"
Code:
25-Jul-2018 08:17:49.504 SEVERE [http-nio-443-exec-31] . /u01/app/ords/ords.18.1.1.95.1251/db_conf/m/url-mapping.xml: Too many open files
java.nio.file.FileSystemException: /u01/app/ords/ords.18.1.1.95.1251/db_conf/m/url-mapping.xml: Too many open files
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
    at java.nio.file.Files.newByteChannel(Files.java:361)

I have tried raising the ulimit for open files to 65536 but all this does is prolong the error.
Code:
tomcat@tomcatserver():/home/tomcat> ulimit -a | grep open
open files                      (-n) 65536

I have found that the error is coming from an apex application that polling the database for changes. The application polls every 3 seconds. if I watch the file count lsof | grep tomcat | wc-l I can see the number increasing while the app is open and then stays steady when closed. and when there are multiple sessions open this number can grow pretty rapidly.

Is there some config value I can set in the server.xml or something on the apex side that will limit the number of files it keeps open? any help will be greatly appreciated.

NOTE. The connections from the application are being closed. I can see this by doing.netstat -a | grep client_hostname I can see an extra connection coming in every 3 seconds and then be disappearing.

Thanks & Regards
Camillelola
 
Last edited by a moderator: