I have a Spring based application that is running in Tomcat 5.5.12. Tomcat is integrated with Apache. Apache host JavaScript client side code that makes Http asynchronous calls to the Spring based application. I'm getting an error reported from Apache as follows:
Too many open files: apr_accept: (client socket) There is speculation that the resources being used in the Spring based app. are not being properly cleaned up. More specifically, the HttpServletRequest and HttpServletResponse objects are leaving streams and sockets open on the Apache server. Should I be explicitly closing streams and sockets of the HttpServletRequest and HttpServletReponse objects? If so, how would this be done? Or does tomcat handle this? Here's an example of what is currently is done. public class Something implements Controller { public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //read something from request doSomething(); return null; } }