spmallette commented on a change in pull request #1081: TINKERPOP-2169/2173 
Responses exceeding maxContentLength cause subsequent queries to hang
URL: https://github.com/apache/tinkerpop/pull/1081#discussion_r264635702
 
 

 ##########
 File path: 
gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java
 ##########
 @@ -291,6 +273,23 @@ public void returnToPool() {
         }
     }
 
+    /*
+     * In the event of an IOException (typically means that the Connection 
might have been closed from the server side
+     * - this is typical in situations like when a request is sent that 
exceeds maxContentLength and the server closes
+     * the channel on its side) or other exceptions that indicate a 
non-recoverable state for the Connection object
+     * (a netty CorruptedFrameException is a good example of that), the 
Connection cannot simply be returned to the
+     * pool as future uses will end with refusal from the server and make it 
appear as a dead host as the write will
+     * not succeed. Instead, the Connection needs to be replaced in these 
scenarios which destroys the dead channel
+     * on the client and allows a new one to be reconstructed.
+     */
+    private void handleConnectionCleanupOnError(final Connection 
thisConnection, final Throwable t) {
+        if (thisConnection.isDead()) {
 
 Review comment:
   So, just to align my understanding - you don't check 
   
   ```java
   if (t instanceof IOException || t instanceof CodecException) {
   ``` 
   
   anymore to replace the connection and rather just check `isDead()` because 
`isDead()` now encompasses situations where those two exceptions would be 
raised?  

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

Reply via email to