Mark Payne created NIFI-8079:
--------------------------------
Summary: DistributedMapCacheClient not properly closing Sockets on
connection failure
Key: NIFI-8079
URL: https://issues.apache.org/jira/browse/NIFI-8079
Project: Apache NiFi
Issue Type: Bug
Components: Extensions
Reporter: Mark Payne
Assignee: Mark Payne
The DistributedMapCacheClient doesn't always properly close Sockets if it fails
to connect. Both the SSLCommsSession and the StandardCommsSession classes have
something like this in the constructor:
{code:java}
socketChannel = SocketChannel.open();
socketChannel.socket().connect(new InetSocketAddress(hostname, port),
timeoutMillis);
{code}
If the call to `socketChannel.socket().connect()` throws an Exception, the
Socket may or may not be closed, depending on the reason for the failure. We
need to ensure that in this case we properly call socketChannel.close().
We should also check for any other spots where we may follow a similar pattern.
This issue can be identified because the instance can run out of open file
handles. Running `lsof -p <pid>` will show a lot of Socket file handles being
used, but `netstat` won't show these because there's no established connection.
The `ss` command will include these in the `closed` count.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)