Leon Finker created GEODE-9819:
----------------------------------

             Summary: Client socket leak in 
CacheClientNotifier.registerClientInternal when error conditions occur for the 
durable client
                 Key: GEODE-9819
                 URL: https://issues.apache.org/jira/browse/GEODE-9819
             Project: Geode
          Issue Type: Bug
          Components: client/server, core
    Affects Versions: 1.14.0
            Reporter: Leon Finker


In CacheClientNotifier.registerClientInternal client socket can be left half 
open and not properly closed when error conditions occur. Such as the case of:
{code:java}
} else {
  // The existing proxy is already running (which means that another
  // client is already using this durable id.
  unsuccessfulMsg =
      String.format(
          "The requested durable client has the same identifier ( %s ) as an 
existing durable client ( %s ). Duplicate durable clients are not allowed.",
          clientProxyMembershipID.getDurableId(), cacheClientProxy);
  logger.warn(unsuccessfulMsg);
  // Set the unsuccessful response byte.
  responseByte = Handshake.REPLY_EXCEPTION_DUPLICATE_DURABLE_CLIENT;
} {code}

It considers the current client connect attempt to have failed. It writes this 
response back to client: REPLY_EXCEPTION_DUPLICATE_DURABLE_CLIENT. This will 
cause the client to throw ServerRefusedConnectionException. What seems wrong 
about this method is that even though it sets "unsuccessfulMsg" and correctly 
sends back a handshake saying the client is rejected, it does not throw an 
exception and it does not close "socket". I think right before it calls 
performPostAuthorization it should do the followiing:
if (unsuccessfulMsg != null) {
      try {
        socket.close();
      } catch (IOException ignore) {
      }
 } else {
    performPostAuthorization(...)
}

Full discussion details can be found at 
https://markmail.org/thread/2gqmbq2m57pz7pxu




--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to