Project: Tomcat
Bug 54702 File descriptor leak at web.xml loading
Reported: 2013-03-15 08:53:36 | Status: resolved fixed

Hello I think I've found a file descriptor leak in file /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (method getGlobalWebXmlSource). A stream is from file "web.xml" is not closed. private WebXml getDefaultWebXmlFragment() { ... 1284 InputSource globalWebXml = getGlobalWebXmlSource(); ... 1337 // Parse global web.xml if present 1338 if (globalWebXml == null) { 1339 // This is unusual enough to log 1340 log.info(sm.getString("contextConfig.defaultMissing")); 1341 } else { 1342 parseWebXml(globalWebXml, webXmlDefaultFragment, false); 1343 } Here is the full stack trace [java.io.FileInputStream.<init>(FileInputStream.java:109)] [org.apache.catalina.startup.ContextConfig.getWebXmlSource(ContextConfig.java:1837)] [org.apache.catalina.startup.ContextConfig.getGlobalWebXmlSource(ContextConfig.java:1744)] [org.apache.catalina.startup.ContextConfig.getDefaultWebXmlFragment(ContextConfig.java:1417)] [org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1253)] [org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)] [org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)] [org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)] [org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)] [org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)] [org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)] [org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)] [org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)] [org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)] [org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)] [org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:542)] [org.apache.catalina.startup.HostConfig.check(HostConfig.java:1462)] [sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)] [sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)] [sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)] [java.lang.reflect.Method.invoke(Method.java:597)] [org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)] [com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)] [com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)] [org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1445)] [org.apache.catalina.manager.HTMLManagerServlet.upload(HTMLManagerServlet.java:301)] [org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:208)] [javax.servlet.http.HttpServlet.service(HttpServlet.java:647)] [javax.servlet.http.HttpServlet.service(HttpServlet.java:728)] [org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)] [org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)] [org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:213)] [org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)] [org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)] [org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)] [org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)] [org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)] [org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)] [org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)] [org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)] [org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)] [org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)] [org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:931)] [org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)] [org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)] [org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)] [org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)] [org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822)] [java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)] [java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)] [java.lang.Thread.run(Thread.java:662)]

Files changed in fix:
java/org/apache/catalina/startup/ContextConfig.java