hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (HTTPCLIENT-1616) Request 'hangs' on invalid response from server
Date Mon, 23 Feb 2015 09:49:12 GMT

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

Oleg Kalnichevski resolved HTTPCLIENT-1616.
-------------------------------------------
    Resolution: Invalid

I added an integration test to verify handling of NO_CONTENT response followed by content
body. HttpClient can handle cases like that just fine.

http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestMalformedServerResponse.java?revision=1661627&view=markup

{noformat}
[DEBUG] RequestAddCookies - CookieSpec selected: default
[DEBUG] RequestAuthCache - Auth cache not set in the context
[DEBUG] PoolingHttpClientConnectionManager - Connection request: [route: {}->http://localhost:34502][total
kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
[DEBUG] PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {}->http://localhost:34502][total
kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] MainClientExec - Opening connection {}->http://localhost:34502
[DEBUG] DefaultHttpClientConnectionOperator - Connecting to localhost/127.0.0.1:34502
[DEBUG] DefaultHttpClientConnectionOperator - Connection established 127.0.0.1:58781<->127.0.0.1:34502
[DEBUG] MainClientExec - Executing request GET /nostuff HTTP/1.1
[DEBUG] MainClientExec - Target auth state: UNCHALLENGED
[DEBUG] MainClientExec - Proxy auth state: UNCHALLENGED
[DEBUG] headers - http-outgoing-0 >> GET /nostuff HTTP/1.1
[DEBUG] headers - http-outgoing-0 >> Host: localhost:34502
[DEBUG] headers - http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] headers - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.4.1-SNAPSHOT (Java
1.5 minimum; Java/1.6.0_45)
[DEBUG] headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate
[DEBUG] wire - http-outgoing-0 >> "GET /nostuff HTTP/1.1[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "Host: localhost:34502[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.4.1-SNAPSHOT (Java
1.5 minimum; Java/1.6.0_45)[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "HTTP/1.1 204 No Content[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "Date: Mon, 23 Feb 2015 09:31:03 GMT[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "Server: TEST/1.1[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "Connection: Keep-Alive[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] headers - http-outgoing-0 << HTTP/1.1 204 No Content
[DEBUG] headers - http-outgoing-0 << Date: Mon, 23 Feb 2015 09:31:03 GMT
[DEBUG] headers - http-outgoing-0 << Server: TEST/1.1
[DEBUG] headers - http-outgoing-0 << Connection: Keep-Alive
[DEBUG] MainClientExec - Connection can be kept alive indefinitely
[DEBUG] PoolingHttpClientConnectionManager - Connection [id: 0][route: {}->http://localhost:34502]
can be kept alive indefinitely
[DEBUG] PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {}->http://localhost:34502][total
kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] RequestAddCookies - CookieSpec selected: default
[DEBUG] RequestAuthCache - Auth cache not set in the context
[DEBUG] PoolingHttpClientConnectionManager - Connection request: [route: {}->http://localhost:34502][total
kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {}->http://localhost:34502][total
kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] MainClientExec - Executing request GET /stuff HTTP/1.1
[DEBUG] MainClientExec - Target auth state: UNCHALLENGED
[DEBUG] MainClientExec - Proxy auth state: UNCHALLENGED
[DEBUG] headers - http-outgoing-0 >> GET /stuff HTTP/1.1
[DEBUG] headers - http-outgoing-0 >> Host: localhost:34502
[DEBUG] headers - http-outgoing-0 >> Connection: Keep-Alive
[DEBUG] headers - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.4.1-SNAPSHOT (Java
1.5 minimum; Java/1.6.0_45)
[DEBUG] headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate
[DEBUG] wire - http-outgoing-0 >> "GET /stuff HTTP/1.1[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "Host: localhost:34502[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.4.1-SNAPSHOT (Java
1.5 minimum; Java/1.6.0_45)[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
[DEBUG] wire - http-outgoing-0 >> "[\r][\n]"
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] wire - http-outgoing-0 << "garbage[\n]"
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] DefaultHttpResponseParser - Garbage in response: garbage
[DEBUG] wire - http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "Date: Mon, 23 Feb 2015 09:31:03 GMT[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "Server: TEST/1.1[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "Content-Length: 20[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "Content-Type: text/plain; charset=ISO-8859-1[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "Connection: Keep-Alive[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "[\r][\n]"
[DEBUG] wire - http-outgoing-0 << "Some important stuff"
[DEBUG] headers - http-outgoing-0 << HTTP/1.1 200 OK
[DEBUG] headers - http-outgoing-0 << Date: Mon, 23 Feb 2015 09:31:03 GMT
[DEBUG] headers - http-outgoing-0 << Server: TEST/1.1
[DEBUG] headers - http-outgoing-0 << Content-Length: 20
[DEBUG] headers - http-outgoing-0 << Content-Type: text/plain; charset=ISO-8859-1
[DEBUG] headers - http-outgoing-0 << Connection: Keep-Alive
[DEBUG] MainClientExec - Connection can be kept alive indefinitely
[DEBUG] PoolingHttpClientConnectionManager - Connection [id: 0][route: {}->http://localhost:34502]
can be kept alive indefinitely
[DEBUG] PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {}->http://localhost:34502][total
kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[DEBUG] PoolingHttpClientConnectionManager - Connection manager is shutting down
[DEBUG] DefaultManagedHttpClientConnection - http-outgoing-0: Close connection
[DEBUG] DefaultManagedHttpClientConnection - http-outgoing-0: Close connection
[DEBUG] PoolingHttpClientConnectionManager - Connection manager shut down
{noformat}

Without additional input from your side I have no other choice but to reject the issue as
invalid.

Oleg

> 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
>    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.4#6332)

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


Mime
View raw message