tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 47718] New: ManagerBase leaks fd to /dev/urandom when context stopped
Date Thu, 20 Aug 2009 21:48:27 GMT

           Summary: ManagerBase leaks fd to /dev/urandom when context
           Product: Tomcat 5
           Version: 5.5.27
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina

--- Comment #0 from George Sexton <> 2009-08-20 14:48:26 PDT ---
On operating systems where /dev/urandom exists,
org.apache.catalina.session.ManagerBase will use it as a source of data for

If you stop a context or undeploy a host, the number of file descriptors that
have /dev/urandom open tomcat remains constant.

For example, if you use the manager application to stop or undeploy a context,
the number of file descriptors to /dev/urandom is the same as before the stop.

File descriptor use is determined by using lsof or examining the /proc/<pid>/fd
directory on Linux.

The same issue is seen if you undeploy a virtual host.

If you undeploy/deploy a context, or remove/add a virtual host, the # of file
descriptors to /dev/urandom will increase each time.

This is because ManagerBase does not close the DataInputStream it holds to

The patch shown below resolves this issue. Stopping a context, or undeploying a
virtual host will close the session manager's reference to /dev/urandom.

   2009-07-24 13:35:00.000000000 -0600
   2009-08-20 13:38:03.000000000 -0600
@@ -688,10 +688,17 @@

    public void destroy() {
         if( oname != null )
             Registry.getRegistry(null, null).unregisterComponent(oname);
+        if (randomIS!=null) {
+            try {
+                randomIS.close();
+            } catch (IOException ioe) {
+            }
+            randomIS=null;
+        }
         oname = null;
         // Don't clear log since it is required in case attributes are changed
         // (eg via JMX) whilst the manager is stopped.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message