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 2013/01/23 11:44:12 UTC

[jira] [Commented] (HTTPASYNC-34) For some urls responding in a 302 the httpget request gets stuck

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

Oleg Kalnichevski commented on HTTPASYNC-34:
--------------------------------------------

[DEBUG] DefaultHttpAsyncClient - [exchange: 1] start execution
[DEBUG] DefaultHttpAsyncClient - [exchange: 1] Request connection for {}->http://www.prweek.com
[DEBUG] PoolingClientAsyncConnectionManager - Connection request: [route: {}->http://www.prweek.com][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
[DEBUG] PoolingClientAsyncConnectionManager - Connection leased: [id: 1][route: {}->http://www.prweek.com][total kept alive: 0; route allocated: 1 of 2; total allocated: 0 of 20]
[DEBUG] DefaultHttpAsyncClient - [exchange: 1] Connection allocated: [id:1][route:{}->http://www.prweek.com][state:null]
[DEBUG] IOSessionImpl - http-outgoing-1 0:0:0:0:0:0:0:0:52266<->94.236.9.97:80[ACTIVE][r:]: Set attribute http.nio.exchange-handler
[DEBUG] IOSessionImpl - http-outgoing-1 0:0:0:0:0:0:0:0:52266<->94.236.9.97:80[ACTIVE][rw:]: Event set [w]
[DEBUG] HttpAsyncRequestExecutor - http-outgoing-1 [ACTIVE]: Connected
[DEBUG] IOSessionImpl - http-outgoing-1 0:0:0:0:0:0:0:0:52266<->94.236.9.97:80[ACTIVE][rw:]: Set attribute http.nio.http-exchange-state
[DEBUG] HttpAsyncRequestExecutor - http-outgoing-1 [ACTIVE] Request ready
[DEBUG] DefaultHttpAsyncClient - [exchange: 1] Attempt 1 to execute request
[DEBUG] IOSessionImpl - http-outgoing-1 0:0:0:0:0:0:0:0:52266<->94.236.9.97:80[ACTIVE][rw:]: Set timeout 3000
[DEBUG] RequestAddCookies - CookieSpec selected: best-match
[DEBUG] RequestAuthCache - Auth cache not set in the context
[DEBUG] RequestTargetAuthentication - Target auth state: UNCHALLENGED
[DEBUG] RequestProxyAuthentication - Proxy auth state: UNCHALLENGED
[DEBUG] headers - http-outgoing-1 >> GET /news/article/1167011/aeromobile-brief-moves-rooster-bell-pottinger/ HTTP/1.1
[DEBUG] headers - http-outgoing-1 >> Host: www.prweek.com
[DEBUG] headers - http-outgoing-1 >> Connection: Keep-Alive
[DEBUG] headers - http-outgoing-1 >> User-Agent: Apache-HttpAsyncClient/4.0-beta3 (java 1.5)
[DEBUG] IOSessionImpl - http-outgoing-1 0:0:0:0:0:0:0:0:52266<->94.236.9.97:80[ACTIVE][rw:]: Event set [w]
[DEBUG] DefaultHttpAsyncClient - [exchange: 1] Request completed
[DEBUG] IOSessionImpl - http-outgoing-1 0:0:0:0:0:0:0:0:52266<->94.236.9.97:80[ACTIVE][rw:w]: 188 bytes written
[DEBUG] IOSessionImpl - http-outgoing-1 0:0:0:0:0:0:0:0:52266<->94.236.9.97:80[ACTIVE][r:w]: Event cleared [w]
[DEBUG] HttpAsyncRequestExecutor - http-outgoing-1 [ACTIVE] Request ready
[DEBUG] IOSessionImpl - http-outgoing-1 0:0:0:0:0:0:0:0:52266<->94.236.9.97:80[ACTIVE][r:r]: 649 bytes read
[DEBUG] headers - http-outgoing-1 << HTTP/1.1 302 Found
[DEBUG] headers - http-outgoing-1 << Date: Wed, 23 Jan 2013 10:15:24 GMT
[DEBUG] headers - http-outgoing-1 << Server: Microsoft-IIS/6.0
[DEBUG] headers - http-outgoing-1 << X-HMIO-Server: BDWeb1-Web5HBI
[DEBUG] headers - http-outgoing-1 << Etag:
[DEBUG] headers - http-outgoing-1 << X-Powered-By: ASP.NET
[DEBUG] headers - http-outgoing-1 << Location: http://www.prweek.com/uk/news/article/1167011/aeromobile-brief-moves-rooster-bell-pottinger/
[DEBUG] headers - http-outgoing-1 << Content-Length: 278
[DEBUG] headers - http-outgoing-1 << Content-type: text/html
[DEBUG] headers - http-outgoing-1 << Set-Cookie: BIGipServerPOOL-94.236.9.97-80=3405949120.20480.0000; path=/
[DEBUG] HttpAsyncRequestExecutor - http-outgoing-1 [ACTIVE(278)] Response received
[DEBUG] DefaultHttpAsyncClient - [exchange: 1] Response received HTTP/1.1 302 Found
[DEBUG] DefaultRedirectStrategy - Redirect requested to location 'http://www.prweek.com/uk/news/article/1167011/aeromobile-brief-moves-rooster-bell-pottinger/'
[DEBUG] DefaultHttpAsyncClient - [exchange: 1] Redirecting to 'http://www.prweek.com/uk/news/article/1167011/aeromobile-brief-moves-rooster-bell-pottinger/' via {}->http://www.prweek.com
[DEBUG] ResponseProcessCookies - Cookie accepted: "[version: 0][name: BIGipServerPOOL-94.236.9.97-80][value: 3405949120.20480.0000][domain: www.prweek.com][path: /][expiry: null]". 
[DEBUG] HttpAsyncRequestExecutor - http-outgoing-1 [ACTIVE(278)] Input ready
[DEBUG] DefaultHttpAsyncClient - [exchange: 1] Consume content
[DEBUG] DefaultHttpAsyncClient - [exchange: 1] Response fully read
[DEBUG] DefaultHttpAsyncClient - [exchange: 1] Connection can be kept alive indefinitely
[DEBUG] IOSessionImpl - http-outgoing-1 0:0:0:0:0:0:0:0:52266<->94.236.9.97:80[ACTIVE][rw:r]: Event set [w]
[DEBUG] HttpAsyncRequestExecutor - http-outgoing-1 [ACTIVE] [content length: 278; pos: 278; completed: true]
[DEBUG] IOSessionImpl - http-outgoing-1 0:0:0:0:0:0:0:0:52266<->94.236.9.97:80[ACTIVE][rw:rw]: -1 bytes read
[DEBUG] IOSessionImpl - http-outgoing-1 0:0:0:0:0:0:0:0:52266<->94.236.9.97:80[ACTIVE][rw:rw]: Close
[DEBUG] HttpAsyncRequestExecutor - http-outgoing-1 [CLOSED]: Disconnected
---
It looks like the server closes the connection without properly informing the client (HTTP/1.1 response contains no 'Connection: close' header), while the client attempts to automatically redirect the request over the same connection.

Oleg

                
> For some urls responding in a 302 the httpget request gets stuck
> ----------------------------------------------------------------
>
>                 Key: HTTPASYNC-34
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-34
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>    Affects Versions: 4.0-beta3
>         Environment: Debian 6, Java 1.6
>            Reporter: Ahsan
>            Priority: Blocker
>             Fix For: 4.0-beta4
>
>
> For some urls responding in a 302 the httpget request gets stuck. e.g http://www.prweek.com/news/article/1167011/aeromobile-brief-moves-rooster-bell-pottinger/
> Here is the code: 
> import java.util.concurrent.CountDownLatch;
> import org.apache.http.HttpResponse;
> import org.apache.http.client.methods.HttpGet;
> import org.apache.http.concurrent.FutureCallback;
> import org.apache.http.impl.nio.client.DefaultHttpAsyncClient;
> import org.apache.http.nio.client.HttpAsyncClient;
> import org.apache.http.params.CoreConnectionPNames;
> public class AsyncClientHttpExchangeFutureCallback {
>     public static void main(String[] args) throws Exception {
>         HttpAsyncClient httpclient = new DefaultHttpAsyncClient();
>         httpclient.getParams()
>             .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 3000)
>             .setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 3000)
>             .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
>             .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true);
>         httpclient.start();
>         try {
>             HttpGet[] requests = new HttpGet[] {
>                     new HttpGet("http://www.prweek.com/news/article/1167011/aeromobile-brief-moves-rooster-bell-pottinger/")
>             };
>             final CountDownLatch latch = new CountDownLatch(requests.length);
>             for (final HttpGet request: requests) {
>                 httpclient.execute(request, new FutureCallback<HttpResponse>() {
>                     public void completed(final HttpResponse response) {
>                         latch.countDown();
>                         System.out.println(request.getRequestLine() + "->" + response.getStatusLine());
>                     }
>                     public void failed(final Exception ex) {
>                         latch.countDown();
>                         System.out.println(request.getRequestLine() + "->" + ex);
>                     }
>                     public void cancelled() {
>                         latch.countDown();
>                         System.out.println(request.getRequestLine() + " cancelled");
>                     }
>                 });
>             }
>             latch.await();
>             System.out.println("Shutting down");
>         } finally {
>             httpclient.shutdown();
>         }
>         System.out.println("Done");
>     }
> }

--
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