Tamas Palfy created NIFI-7286:
---------------------------------
Summary: ListenTCPRecord doesn't release port when stopping +
terminating while running
Key: NIFI-7286
URL: https://issues.apache.org/jira/browse/NIFI-7286
Project: Apache NiFi
Issue Type: Bug
Reporter: Tamas Palfy
*Reproduction steps*
# Set '{{ListenTCPRecord.Read Timeout}}' property to manageable value (like 120
second)
# Start {{ListenTCPRecord}}, listen on port XXX
# {{telnet HOST XXX}} (This will open and keep a connection to that port)
# Stop {{ListenTCPRecord}} while connection is open (After that, notice the 2
active threads on the processor)
# Terminate {{ListenTCPRecord}}
# Now any process (be it {{ListenTCPRecord}} or {{ListenTCP}}) that tries to
listen on port XXX will report an {{"Address already in use"}} error
*Root cause*
{{ListenTCPRecord}} is trying to do cleanup in an {{@OnStopped}} method. The
problem is that these methods won't be called while there are still running
worker threads. When the processor is terminated, it eliminates the cleanup
thread as well, so the cleanup never happens.
{{ListenTCP}} for example doesn't exhibit this issue because its cleanup method
is not annotated with {{@OnStopped}} but with {{@OnUnscheduled}}.
*Fix*
The solution is fairly simple: we just need to annotate the {{ListenTCPRecord}}
cleanup method with {{@OnUnscheduled}} instead of {{@OnStopped}}.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)