You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Tad Whitenight (JIRA)" <ji...@apache.org> on 2013/07/03 15:31:21 UTC

[jira] [Commented] (HTTPCORE-345) Resource leak in EntityAsyncContentProducer when produceContent is never called

    [ https://issues.apache.org/jira/browse/HTTPCORE-345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13698957#comment-13698957 ] 

Tad Whitenight commented on HTTPCORE-345:
-----------------------------------------

Oleg,

Thanks for taking a look so quickly and applying to the 4.2.x branch as well.
I'm concerned that the new change results in the entity InputStream getting close()ed twice in the case where a channel was allocated.
The channel close *does* close the content InputStream, which is why I found it necessary to add the entityNeedsConsumed boolean.
Otherwise looks great.

Thanks again,
Tad
                
> Resource leak in EntityAsyncContentProducer when produceContent is never called
> -------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-345
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-345
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore, HttpCore NIO
>    Affects Versions: 4.2.4
>         Environment: Tested on Sun JDK 6 Linux 64 & Win 32
>            Reporter: Tad Whitenight
>             Fix For: 4.2.5, 4.3-beta3
>
>         Attachments: EntityAsyncContentProducer.diff, TestHttpAsyncPrematureTermination.diff
>
>
> The HttpAsyncContentProducer javadoc does not mention that the produceContent method must be called.
> However, the close() method of EntityAsyncContentProducer assumes that the produceContent method was previously called.
> Quickly cancelled requests made to an HttpAsyncService can realize this scenario and thus leak resources backing response entities.
> I discovered this issue in 4.2.4, but am currently reproducing the issue with trunk.
> I'll attach a simplified test case shortly.
> A possible fix is to check if the channel was never created and close the underlying entity in this case.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org