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

Pranav Arora commented on HTTPCORE-587:
---------------------------------------

Not sure if this would be of any help but I have added a null check to handle 
the NullPointerException described at the end of post and it has been running 
fine. The original exception still appears from time to time but the 
CustomExceptionHandler handles it and the I/O reactor does not burn down 
immediately.

> Connection must be created by connection manager issue
> ------------------------------------------------------
>
>                 Key: HTTPCORE-587
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-587
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore, HttpCore NIO
>    Affects Versions: 4.4.11
>            Reporter: Pranav Arora
>            Priority: Major
>
> This is the same issue that is discussed in HTTPCORE-370 and HTTPCORE-574. I 
> am facing the following exception:
>  
>  
> {code:java}
> [ERROR] [] 2019-07-29 09:33:10.639 [pool-2-thread-1] InternalHttpAsyncClient 
> - I/O reactor terminated abnormally
> org.apache.http.nio.reactor.IOReactorException: I/O dispatch worker 
> terminated abnormally
> at 
> org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:356)
> at 
> org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:221)
> at 
> org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64)
> at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
> Caused by: java.lang.IllegalStateException: Connection must be created by 
> connection manager
> at 
> org.apache.http.impl.nio.client.InternalIODispatch.createConnection(InternalIODispatch.java:56)
> at 
> org.apache.http.impl.nio.client.InternalIODispatch.createConnection(InternalIODispatch.java:39)
> at 
> org.apache.http.impl.nio.reactor.AbstractIODispatch.connected(AbstractIODispatch.java:70)
> at 
> org.apache.http.impl.nio.reactor.BaseIOReactor.sessionCreated(BaseIOReactor.java:248)
> at 
> org.apache.http.impl.nio.reactor.AbstractIOReactor.processNewChannels(AbstractIOReactor.java:427)
> 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:588)
> ... 1 more{code}
>  
> This occurs randomly during production and I have not been able to reproduce 
> it locally. What I instead tried was pass a custom exception handler. 
>  
>  
> {code:java}
> public class CustomExceptionHandler implements IOReactorExceptionHandler {
>  @Override
>  public boolean handle(IOException ex) {
>   log.error("I/O Reactor IO exception", ex);
>   return false;
>  }
>  @Override
>  public boolean handle(RuntimeException ex) {
>   log.error("I/O Reactor Runtime Exception", ex);
>   if (ex instanceof IllegalStateException) {
>    throw new CancelledKeyException();
>   }
>   return false;
>  }
> }
> {code}
>  
>  
> It helped for the above exception as it did not lead to immediate shutdown of 
> I/O Reactor but now I am facing a different issue.
>  
>  
> {code:java}
> [ERROR] [] 2019-07-30 18:22:37.684 [pool-2-thread-1] InternalHttpAsyncClient 
> - I/O reactor terminated abnormally
> java.lang.NullPointerException: null
> at 
> <packageNameTruncated>.DefaultConnectingIOReactorTemp.processEvent(DefaultConnectingIOReactorTemp.java:158)
> at 
> <packageNameTruncated>.DefaultConnectingIOReactorTemp.processEvents(DefaultConnectingIOReactorTemp.java:136)
> at 
> org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:351)
> at 
> org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:221)
> at 
> org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64)
> at java.lang.Thread.run(Thread.java:748)
> {code}
>  
>  
> DefaultConnectingIOReactorTemp is exactly the same as 
> DefaultConnectingIOReactor with the added code that was intended to fix 
> HTTPCORE-370. The corresponding line in DefaultConnectingIOReactor is 167 
> (final SessionRequestImpl sessionRequest = 
> requestHandle.getSessionRequest()). The added code is this: 
> https://github.com/ok2c/httpcore/commit/aa812282f26fdd1975233a892c5405fa0da781b4#diff-d577e717cb1e97f3a3c0adbc8d563062
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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

Reply via email to