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

Abraham Cabanillas commented on HTTPCLIENT-2152:
------------------------------------------------

I have been trying to reproduce it but it is quite difficult. This is something 
happening once or twice per day in severs with around 6K request per second.

But what it seems clear is that this method `setSocketTimeout()` shouldn't 
shutdown I/O reactor when endpoint is closed.

This method generate a java.lang.IllegalStateException exception that is caught 
in org.apache.hc.core5.reactor.InternalChannel.handleIOEvent() and closing the 
I/O reactor.

 
{code:java}
final void handleIOEvent(final int ops) {
  try {
    onIOEvent(ops);
  } catch (final CancelledKeyException ex) {
    close(CloseMode.GRACEFUL);
  } catch (final Exception ex) {
    onException(ex);
    close(CloseMode.IMMEDIATE);
  }
}{code}

> I/O reactor shutdown when endpoint is closed
> --------------------------------------------
>
>                 Key: HTTPCLIENT-2152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (async)
>    Affects Versions: 5.0.3, 5.1-beta1
>            Reporter: Abraham Cabanillas
>            Priority: Major
>             Fix For: 5.0.4, 5.1-beta2
>
>         Attachments: httpclient_error_traces.txt
>
>
> I am using async http client for real time bidding project in a cluster of 
> servers. Each server execute around 6K request per second and sometimes each 
> server restarted becase I/O reactor is shutdown. It seems that there is a 
> race condition in the code that produces this behavior.
> It seems that the race condition appears between this method:
> {{org.apache.hc.client5.http.impl.async.AsyncConnectExec$1.completed()}}
> and this method:
> {{org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager$InternalConnectionEndpoint.setSocketTimeout()}}
> because in the first method the endpoint is connected but in the second one 
> this code fails:
>  
> {code:java}
> ManagedHttpClientConnection getValidatedConnection() {    
>    final ManagedHttpClientConnection conn = getConnection();    
>    Asserts.check(conn.isOpen(), "Endpoint is not connected");    
>    return conn; 
> }{code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to