Return-Path: Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: (qmail 5430 invoked from network); 13 Aug 2010 11:22:47 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Aug 2010 11:22:47 -0000 Received: (qmail 99424 invoked by uid 500); 13 Aug 2010 11:22:47 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 98711 invoked by uid 500); 13 Aug 2010 11:22:42 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 98694 invoked by uid 99); 13 Aug 2010 11:22:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Aug 2010 11:22:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Aug 2010 11:22:38 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o7DBMHAD010569 for ; Fri, 13 Aug 2010 11:22:17 GMT Message-ID: <4738711.328241281698537074.JavaMail.jira@thor> Date: Fri, 13 Aug 2010 07:22:17 -0400 (EDT) From: "Andreas Veithen (JIRA)" To: issues@cxf.apache.org Subject: [jira] Commented: (CXF-2940) AttachmentOutInterceptor does not always close the input streams In-Reply-To: <18955226.325741281688096721.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CXF-2940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12898185#action_12898185 ] Andreas Veithen commented on CXF-2940: -------------------------------------- Martin, Your analysis is based on a wrong assumption, namely that DataSource is a holder for an already open InputStream. This is not true. The InputStream is only created when the getInputStream method is called, and for every invocation, a new InputStream is created (i.e. DataSource acts as a factory for InputStream objects). Therefore, InputStream#close() must be called once for every call to DataSource#getInputStream. In particular, if DataSource#getInputStream is never called, the code consuming the DataSource doesn't need to do any cleanup. Note that this is clearly specified in the Javadoc of the DataSource interface. Thus, the resource leak only occurs if the DataSource implementation doesn't conform to the contract of the DataSource interface. > AttachmentOutInterceptor does not always close the input streams > ---------------------------------------------------------------- > > Key: CXF-2940 > URL: https://issues.apache.org/jira/browse/CXF-2940 > Project: CXF > Issue Type: Bug > Components: Core > Affects Versions: 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.2, 2.1.5, 2.2.1, 2.2.2, 2.0.12, 2.1.6, 2.2.3, 2.1.7, 2.2.4, 2.1.8, 2.2.5, 2.1.9, 2.2.6, 2.2.7, 2.2.8, 2.2.9, 2.1.10, 2.0.13 > Reporter: Martin Renner > > Under some circumstances, AttachmentOutInterceptor does not close the input stream that it uses to read the contents of an attachment and to stream it to the client. This can lead to a resource leak, because those input streams often belong to server resources like database results, files from the server's filesystem etc. > The stream gets closed, if an exception occurs _while_ streaming the content of one particular input stream to the client. However, the streams are not closed, if > * an exception occurs on the outbound chain somewhere between the very first interceptor and AttachmentOutInterceptor. > * there are several attachments, writing of one fails (maybe because the client closed the connection) and there are some more attachments left. Then the streams of those outstanding attachments won't get closed. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.