You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Dmitry Potapov (JIRA)" <ji...@apache.org> on 2014/02/13 09:47:19 UTC

[jira] [Commented] (HTTPASYNC-68) DefaultClientExchangeHandlerImpl.requestConnection() must close current managed connection

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

Dmitry Potapov commented on HTTPASYNC-68:
-----------------------------------------

Tested with trunk version. Works fine. Thank you for quick response.

> DefaultClientExchangeHandlerImpl.requestConnection() must close current managed connection
> ------------------------------------------------------------------------------------------
>
>                 Key: HTTPASYNC-68
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-68
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>    Affects Versions: 4.0 Final
>            Reporter: Dmitry Potapov
>             Fix For: 4.0.1
>
>         Attachments: abort-connection-before-requesting.patch
>
>
> Consider the following scenario:
> 1. HttpAsyncClient.execute() creates DefaultClientExchangeHandlerImpl and calls DefaultClientExchangeHandlerImpl.start()
> 2. DefaultClientExchangeHandlerImpl.start() in turn calls .requestConnection()
> 3. .requestConnection() asks connection pool for connection
> 4. Connection pool creates new connection to target server and returns callback to the DefaultClientExchangeHandlerImpl
> 5. DefaultClientExchangeHandlerImpl stores connection to managedConn and sends request to server
> 6. Server sends TCP FIN
> 7. Client's AbstractIOReactor notices activity in socket channel and calls DefaultNHttpClientConnection.consumeInput()
> 8. DefaultNHttpClientConnection.consumeInput() detects eof on connection and calls DefaultClientExchangeHandlerImpl.inputTerminated()
> 9. DefaultClientExchangeHandlerImpl.inputTerminated() in turn calls DefaultClientExchangeHandlerImpl.requestConnection()
> 10. Connection pool creates another connection to server and returns it to DefaultClientExchangeHandlerImpl.
> 11. DefaultClientExchangeHandlerImpl stores newly allocated connection to managedConn and does nothing with its previous value. So previous connection left open and not returned to pool. If maxPerRoute is relatively small, all connections can be exhausted before gc will occur and requests will hang for indefinite time



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

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