You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Anurag Agarwal (Jira)" <ji...@apache.org> on 2019/11/16 15:42:00 UTC

[jira] [Created] (HTTPASYNC-155) I/O Reactor Shutdown issues due to race condition in AbstractClientExchangeHandler

Anurag Agarwal created HTTPASYNC-155:
----------------------------------------

             Summary: I/O Reactor Shutdown issues due to race condition in AbstractClientExchangeHandler
                 Key: HTTPASYNC-155
                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-155
             Project: HttpComponents HttpAsyncClient
          Issue Type: Bug
            Reporter: Anurag Agarwal


{code:java}
HTTP GET http://localhost:8080/AdExchange/healthcheck: 500  Output: Health check failed because I/O reactor status STOPPED
Time: Fri Nov 15 15:52:38 UTC 2019
org.apache.http.impl.conn.ConnectionShutdownException
	at org.apache.http.impl.nio.conn.CPoolProxy.getValidConnection(CPoolProxy.java:74)
	at org.apache.http.impl.nio.conn.CPoolProxy.getContext(CPoolProxy.java:219)
	at org.apache.http.impl.nio.client.AbstractClientExchangeHandler.connectionAllocated(AbstractClientExchangeHandler.java:328)
	at org.apache.http.impl.nio.client.AbstractClientExchangeHandler.access$000(AbstractClientExchangeHandler.java:62)
	at org.apache.http.impl.nio.client.AbstractClientExchangeHandler$1.completed(AbstractClientExchangeHandler.java:387)
	at org.apache.http.impl.nio.client.AbstractClientExchangeHandler$1.completed(AbstractClientExchangeHandler.java:383)
	at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:122)
	at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager$1.completed(PoolingNHttpClientConnectionManager.java:306)
	at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager$1.completed(PoolingNHttpClientConnectionManager.java:297)
	at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:122)
	at org.apache.http.nio.pool.RouteSpecificPool.completed(RouteSpecificPool.java:146)
	at org.apache.http.nio.pool.AbstractNIOConnPool.requestCompleted(AbstractNIOConnPool.java:563)
	at org.apache.http.nio.pool.AbstractNIOConnPool$InternalSessionRequestCallback.completed(AbstractNIOConnPool.java:883)
	at org.apache.http.impl.nio.reactor.SessionRequestImpl.completed(SessionRequestImpl.java:154)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processNewChannels(AbstractIOReactor.java:426)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:287)
	at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
	at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)
	at java.lang.Thread.run(Thread.java:748)
{code}

I am currently not able to identify the excat source of this issue. But somewhere I am getting a hint that before execution of line AbstractClientExchnageHandler:328 
{noformat}
final HttpContext context = managedConn.getContext();
{noformat}

Cancel is called which discards the connection and detach the pool entry from the proxy. It was difficult to come up with the exact source since there are many places from where dicard connection and release connection is being called. But since only after adding the cancel workflow such errors are coming up, I tried to take that road and it seems possible that the race condition can indeed happen.

We can notice in that method just few lines above this line we are checking if the handler is closed or not but even that line may have passed after which the connection was actually closed. It was just closed before the execution of this line as the line just above this line still has entry or else NullPointerException would have come.



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

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