Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TCPServer crash on shutdown
#5
(08-07-2018, 12:53 AM)rlebeau Wrote: But OK, you use PostMessage() for that.  Which HWND do you post to exactly?  Hopefully to your own manually-created HWND and NOT to a VCL Form/Control's Handle property?  Because the Handle property is not safe to access outside of the UI thread, even for something as "innocent" as (Send|Post)Message().

Uh oh. I have this defined in the public declarations section of my main form's class:

procedure SyncMessage(var Msg: TMessage); message WM_User + 2;

and then call it from a worker thread:

PostMessage(MainForm.Handle, WM_User + 2, Mask, 0);

Am I doing that wrong?

(08-07-2018, 12:53 AM)rlebeau Wrote: Can you run your server inside the debugger and still see the problem happen?  TIdTCPServer names all of the threads that it creates, do you see the names appear in the debugger?  Does the lingering thread have a name assigned?

I'll try that tomorrow.  I couldn't get it to crash today. Process Explorer showed the thread as "TMethodImplementationIntercept" with an 32-bit number on the end that changes each time.

Could adjusting the default MAXSTACKSIZE parameter be a problem? I have it set at 256K instead of the default 1024K to reduce the memory load.
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)