Joseph Percivall created NIFI-3375:
--------------------------------------
Summary: Add a option expiration/timeout for idle connections to
SocketChannelDispatcher
Key: NIFI-3375
URL: https://issues.apache.org/jira/browse/NIFI-3375
Project: Apache NiFi
Issue Type: Improvement
Reporter: Joseph Percivall
Originally found with the ListenTCP processor, it would be nice to have the
ability to specify a timeout on which to expire idle connections.
The SocketChannelDispatcher runs an infinite loop checking all the selectorKeys
available and imposes a hard limit of the total number connections. At the end
of each iteration of the loop it marks all idle sockets as READ_ABLE[1]. Then
in the Socket Handler, it only marks the socket as closed if the socketChannel
returns -1[2]. Returning 0 is valid for non-blocking socket channel[3], so If a
client never closes the connection then this connection will remain open
forever.
There should be an option to expire connections after a certain length of time
without data being read.
[1]
https://github.com/JPercivall/nifi/blob/372ffb8aa08ad51a8faf25e56b794183df9f8a4a/nifi-commons/nifi-processor-utilities/src/main/java/org/apache/nifi/processor/util/listen/dispatcher/SocketChannelDispatcher.java#L212-L212
[2]
https://github.com/JPercivall/nifi/blob/372ffb8aa08ad51a8faf25e56b794183df9f8a4a/nifi-commons/nifi-processor-utilities/src/main/java/org/apache/nifi/processor/util/listen/handler/socket/StandardSocketChannelHandler.java#L87-L87
[3] http://stackoverflow.com/a/11451152/5252122
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)