You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2015/05/02 17:21:06 UTC

[jira] [Resolved] (HTTPCORE-402) impossible to close a ChunkedInputStream.

     [ https://issues.apache.org/jira/browse/HTTPCORE-402?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-402.
----------------------------------------
    Resolution: Invalid

Content stream #close method is not meant to close the underlying connection. There is nothing stopping you from shutting the connection, though, if that is what you want.

http://hc.apache.org/httpcomponents-client-4.4.x/tutorial/html/fundamentals.html#d5e145

Oleg

> impossible to close a ChunkedInputStream.
> -----------------------------------------
>
>                 Key: HTTPCORE-402
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-402
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore
>    Affects Versions: 4.3.3
>            Reporter: James Nord
>            Priority: Critical
>
> If you have a server that will just send Chunked output for streaming then it is impossible to close the ChunkedInputStream correctly.
> When calling close - it will helpfully try to read until the server sends the terminating chuck - but if this is never going to arrive (as is the case with Docker and many other servers that send notification updates via chunking)  the close method never returns and goes into a loop reading and throwing away every single chunk.
> Whilst is is a worthy aim of not keeping the connection overhead low - if you want to close a stream you want to close it.  Chunks, pipelining or anything else don;t matter and you want to close things for a reason.
> In this case it prevents users from ever closing a HTTP connection so it is never available for re-use in any case.
> see https://github.com/docker-java/docker-java/issues/196 for a real life example of why this is bad.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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