Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TCPServer crash on shutdown
#1
Since the Embarcadero forums seem to be unusable now, thought I try here first.  I've Googled around and seen this issued raised before but nothing I've found so far has helped.

After years of no issues, I'm suddenly having a problem with shutting down a TIdTCPServer component. Setting Active := False is occasionally locking up my app. So much so that the process cannot be killed in either the Windows Task Manager or Process Explorer. One single thread (identified as TMethodImplementationIntercept in Process Explorer) remains and a Windows reboot is the only way out. I upgraded to a more recent Indy version (10.6.2.5469) but the problem persists. It happens maybe 10% of the time even when I perform the same steps over and over.

By inserting markers in the code to record to an error log (which runs in a critical section) I've traced the problem this deep, where 2 listening threads are supposed to terminate:

Active := False
SetActive
Shutdown
StopListing
LListener.Binding.CloseSocket  (if crashes, always does so on the first of two loops)
Disconnect
GStack.Disconnect(Handle)

That last one never returns. It's a virtual abstract method so I'm not sure where to go from there.

My app is a game server with an HTTPServer (that servers an HTML5 web app client) and a TCPServer and acts as websocket connection for the client. Both are started and stopped together from a button click in the app's main thread. The HTTPServer never crashes on shutdown, only the TCPServer does. I've tried using a worker thread to shut down the TCPServer. That allows me to exit the app when the problem occurs but the EXE is still running on the Processes tab and cannot be killed. I'm using the OnConnect, OnDisconnect, and OnExecute events and all are contained in try/except blocks that reraise Indy exceptions like this:

try
 // stuff here
except
  on E: Exception do
  begin
    if not(E is EIdException) then LogData.AddError('WSServerConnect error: ' + E.Message);
    raise;
  end;
end;

So what else can I check to track this down?
Reply


Messages In This Thread
TCPServer crash on shutdown - by kbriggs - 08-05-2018, 07:50 PM
RE: TCPServer crash on shutdown - by rlebeau - 08-06-2018, 09:18 PM
RE: TCPServer crash on shutdown - by kbriggs - 08-07-2018, 12:07 AM
RE: TCPServer crash on shutdown - by rlebeau - 08-07-2018, 12:53 AM
RE: TCPServer crash on shutdown - by kbriggs - 08-07-2018, 03:10 AM
RE: TCPServer crash on shutdown - by rlebeau - 08-07-2018, 06:45 PM
RE: TCPServer crash on shutdown - by kbriggs - 08-07-2018, 07:36 PM
RE: TCPServer crash on shutdown - by kbriggs - 08-09-2018, 09:53 PM
RE: TCPServer crash on shutdown - by kbriggs - 08-07-2018, 11:47 PM
RE: TCPServer crash on shutdown - by kbriggs - 08-10-2018, 12:13 AM
RE: TCPServer crash on shutdown - by rlebeau - 08-11-2018, 12:35 AM
RE: TCPServer crash on shutdown - by kudzu - 08-10-2018, 02:59 PM
RE: TCPServer crash on shutdown - by kbriggs - 08-12-2018, 08:33 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)