https://issues.apache.org/jira/browse/TINKERPOP-2169
https://issues.apache.org/jira/browse/TINKERPOP-2173

**Problem**
1. On receiving a CorruptedFrameException, the current code does not decrement 
the borrowed count on the connection and marks the connection for destruction. 
However, the connection never gets destroyed since the it can only be destroyed 
when the borrowed count is 0. This leads to unnecessary connections waiting in 
the bin to be cleared.
2. If a connection is serving multiple requests and one of the requests gets a 
CorruptedFrameException, Netty closes the underlying channel and thus, other 
requests on the same channel receive a ChannelClosed exception. The current 
code marks the server host as unavailable (thus closing out other connections 
for the host as well) on a ChannelClosed exception whereas that is not 
necessarily true. Marking the host as unavailable is too aggressive in this 
scenario.

**Changes**
1. Connection.isDead() logic now consists of checking the underlying channel.
2. If a connection is dead, destroy the connection, irrespective of the number 
of borrowed items. Informing the inflight (pending) request futures about this 
is already done by the response handler.
3.  If a connection is returned to the pool and it is dead, replace the 
connection. Do not consider the host as unavailable since a single connection 
dead does not imply a dead host.
4.  Add a warning log whenever a host is marked as unavailable.
5.  Replace the connection on ClosedChannel exception.
6. Reset the logging level in the integration tests after each test execution.

**Testing**

- Added a test to reproduce the leak (Problem#1). The test fails before the 
fixes and passes after the fixes.
- `mvn verify -DskipIntegrationTests=false`  & `mvn verify install` is 
successful for gremlin-server & gremlin-driver


[ Full content available at: https://github.com/apache/tinkerpop/pull/1081 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to