[ 
https://issues.apache.org/jira/browse/NIFI-7286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17067790#comment-17067790
 ] 

ASF subversion and git services commented on NIFI-7286:
-------------------------------------------------------

Commit c79473baf5a8bb3dc054b13c57eefef1a4088d4c in nifi's branch 
refs/heads/master from Tamas Palfy
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=c79473b ]

NIFI-7286 ListenTCPRecord cleanup changed from @OnStopped to @OnUnscheduled


> 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
>            Assignee: Tamas Palfy
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> *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)

Reply via email to