jihoonson commented on a change in pull request #6090: Fix missing exception 
handling as part of 
`io.druid.java.util.http.client.netty.HttpClientPipelineFactory`
URL: https://github.com/apache/incubator-druid/pull/6090#discussion_r207670266
 
 

 ##########
 File path: 
java-util/src/main/java/io/druid/java/util/http/client/NettyHttpClient.java
 ##########
 @@ -280,18 +280,18 @@ public void exceptionCaught(ChannelHandlerContext 
context, ExceptionEvent event)
             if (response != null) {
               handler.exceptionCaught(response, event.getCause());
             }
-            removeHandlers();
             try {
-              channel.close();
+              if (channel.isOpen()) {
+                channel.close();
+              }
             }
             catch (Exception e) {
-              // ignore
+              log.warn(e, "Error while closing channel");
             }
             finally {
+              removeHandlers();
 
 Review comment:
   Hmm, this causes another wacky error like below:
   
   ```
   2018-08-03T21:17:17,413 WARN [HttpClient-Netty-Worker-0] 
org.jboss.netty.channel.DefaultChannelPipeline - An exception was thrown by a 
user handler while handling an exception event ([id: 0x2a95abde, 
/127.0.0.1:58801 :> localhost/127.0.0.1:58798] EXCEPTION: 
java.lang.IllegalArgumentException: invalid version format: GET)
   java.util.NoSuchElementException: last-handler
   ```
   
   This is because the channel is already closed when we try to remove 
handlers. Let's just remove this line. It should be fine because the channel is 
already closed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to