File descriptors vs. CGI execution

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

File descriptors vs. CGI execution

Martin Dubuc
 I am running Tomcat 5.5.12.

I have noticed with lsof that every time a CGI script is executed within Tomcat, the number of file descriptors used by Tomcat increases by 1. Once in a while, the number of file descriptors drops to its initial level. However, I am seeing many instances where the number of file descriptors increases steadily until it reaches a large number (around 1000 files). At that point, when the script executes, the web server generates an HTTP status 500 error page. If I execute the script after the Web server has done some maintenance work and the number of file descriptors is back to an acceptable level, then, the CGI script executes without any issues.

I have done some experiments by running some java code as part of an application that runs on the Web server. If I run a system call (unsing Runtime.getRuntime().exec) and grab the input/output/error streams, but do not explicitly close them, the number of file descriptor in use increases and stays to this level for some time. Eventually, it comes back to the original number. I have the impression that there is a link between garbage collection and the recylcing of file descriptors.

Anybody has experienced something similar? Is this an issue that should be solved in Tomcat. Are there workarounds?


Yahoo! Photos
 Got holiday prints? See all the ways to get quality prints in your hands ASAP.