Kenneth Howe created GEODE-5333:
-----------------------------------

             Summary: Failed connection objects may be retained indefinitely - 
can lead to OutOfMemoryError 
                 Key: GEODE-5333
                 URL: https://issues.apache.org/jira/browse/GEODE-5333
             Project: Geode
          Issue Type: Bug
            Reporter: Kenneth Howe


After refactoring of {{ConnectionFactoryImpl}} and {{ConnectionConnector}} 
(GEODE-5261), connections that fail during connect due to an execption (for 
example, {{GemfireSecurityException}}) are not destroyed 
({{connection.destroy()}}).

Prior to refactoring, the {{connect()}} was performed in a try/catch/finally in 
{{ConnectionFactoryImpl.createClientToServerConnection()}}
{code:java}
  public Connection createClientToServerConnection(ServerLocation location, 
boolean forQueue)
      throws GemFireSecurityException {
    ConnectionImpl connection = new ConnectionImpl(this.ds, 
this.cancelCriterion);
...
    try {
      ClientSideHandshake connHandShake = new 
ClientSideHandshakeImpl(handshake);
      connection.connect(endpointManager, location, connHandShake, 
socketBufferSize,
          handshakeTimeout, readTimeout, getCommMode(forQueue), 
this.gatewaySender,
          this.socketCreator);
...
    } catch (... e) {
      throw e;
...
    } finally {
      if (!initialized) {
        connection.destroy();
        failureTracker.addFailure();
        connection = null;
      }
    }
{code}
After the refactoring, the connect is performed in 
{{ConnectionConnector.connectClientToServer}}. If {{connect()}} throws an 
exception back to the {{ConnectionFactoryImpl}}, the connection object in 
{{ConnectionConnector}} isn't destroyed.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to