ResourceSource.getInfos() leaves URLConnection open, resulting in 'too may open 
files' condition
------------------------------------------------------------------------------------------------

                 Key: FORTRESS-22
                 URL: http://issues.apache.org/jira/browse/FORTRESS-22
             Project: Excalibur Fortress
          Issue Type: Bug
          Components: Implementation
    Affects Versions: 1.0
         Environment: Sun Solaris 5.9
JDK 1.4
Cocoon 2.1.8
            Reporter: Ellis Pritchard


org.apache.excalibur.source.impl.ResourceSource#getInfos() opens a 
URLConnection [line 79] to obtain information about the resource, however, it 
does not cause this connection to be closed (i.e. call getInputStream() and 
then close() that), thus the resulting file-descriptor will only be closed when 
the garbage collector collects the URLConnection object.

Quote from java.net.URLConnection javadoc:
"Calling the close() methods on the InputStream or OutputStream of an 
URLConnection after a request may free network resources associated with this 
instance, unless particular protocol specifications specify different 
behaviours for it."

On a high-load system, which is accessing resources in jars frequently (even if 
only as a side-effect of calling getValidity()), this may result in all 
available file-descriptors being used within a short period, and because GC is 
not kicked off when a process runs out of file-descriptors, this can result in 
a DoS.

This problem has occured on a live system running Apache Cocoon 2.1.8.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to