Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Disconnected TCPServer thread won't terminate
#8
(04-19-2022, 05:14 AM)kbriggs Wrote: I changed that part of my OnExecute code to this:

Why not OnConnect?

(04-19-2022, 05:14 AM)kbriggs Wrote: I put that online and checked back 3 hours later. My log had 127 rogue entries recorded (most from Brazil this time) but not a single one of their threads was running. So problem solved, I guess?

No, not even close. Under normal conditions, this kind of workaround is never needed. Something in your project is preventing the threads from stopping themselves properly. But calling Terminate() directly is just a signal, the threads still have to actively check that signal and actually exit themselves, which implies the threads are not being blocked. So, I have no idea what is going on here.

Did you check if the OnExecute event is still firing after calling Disconnect()? It shouldn't be, and if it is not then the server should be signalling the thread to stop between iterations.

Something else to try - see if calling AContext.Binding.CloseSocket() instead of AContext.Connection.Disconnect() makes any difference. CloseSocket() just closes the underlying socket at the system level, but leaves everything else in Indy alone. Whereas Disconnect() closes down the entire IOHandler, which will also close the socket during its cleanup.

(04-19-2022, 05:14 AM)kbriggs Wrote: I haven't updated my Indy install in quite a while. I have version 10.6.2.5469.  Have there been any changes since then might be relevant to this situation?

Possibly. For instance, there was a checkin made 7 months ago to have the server use AContext.Binding.CloseSocket() instead of AContext.Connection.Disconnect() when cleaning up threads.

Reply


Messages In This Thread
RE: Disconnected TCPServer thread won't terminate - by rlebeau - 04-19-2022, 03:36 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)