Affects Version/s: None
Fix Version/s: 1.12.0
- 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
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.
The solution is fairly simple: we just need to annotate the ListenTCPRecord cleanup method with @OnUnscheduled instead of @OnStopped.