You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Gonzalo Bermúdez (JIRA)" <ji...@apache.org> on 2017/02/15 21:10:41 UTC

[jira] [Commented] (HTTPCLIENT-1616) Request 'hangs' on invalid response from server

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

Gonzalo Bermúdez commented on HTTPCLIENT-1616:
----------------------------------------------

I can't access the URL for the revision to check the test case (404), but from the debug logs you seem to be sending LF's in the 204 response's content.

I've seen this issue but with gzipped 204 responses, where LF's aren't present. Then the subsequent request has garbage before the HTTP response header, so the whole response is considered garbage.

> Request 'hangs' on invalid response from server
> -----------------------------------------------
>
>                 Key: HTTPCLIENT-1616
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1616
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Fluent HC, HttpClient (classic)
>    Affects Versions: 4.3.6
>         Environment: Java 8
> Running test with either Maven or IntelliJ.
>            Reporter: Joost den Boer
>
> When using the fluent api to do a request and the response of the previous request was status NoContent, but (!) the server did send some content anyway, then the next request is blocked for a long time. No response is ever returned. Eventually some timeout will unblock the thread, but the request has failed.
> To reproduce this issue:
> - create a server which returns a NoContent with some text body.
> - do a first request
> - do a second request. This request hangs/blocks the thread for long time.
> We're using Fluent API to easily unit test our rest api. In a test class where a test was doing multiple requests, the first test would pass, but the second test would stall and eventually fail. Individually the tests were passing. I could not find any issue on the server side, so I tried another http client (Ning) which seemed to fix the issue. After rewriting the test to use Ning instead of HttpClient, the tests were successful, but when I changed it to reuse the same AsyncHttpClient, I got the same issue. However, because Ning does not block but throws an exception, I was finally able to find the issue which caused the problem: an endpoint returning a NoContent status, but with some text body.
> Even though this is a server issue, the httpclient should not block the thread for such a long time and also return a proper error so this kind of issues so the cause is easier to track down. Now, if I would not have used Ning, I would not have found the issue.
> The problem occurred when using Fluent Api, but I assume to cause for the thread to block and not return a proper error is in the HttpClient component.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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