Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIdSmtpServer not freeing threads
#2
(10-24-2018, 05:04 PM)bluewwol Wrote: after 24 hours there are well over 1,000 threads active, this would not be all the threads created (fewer than messages received) in that period.

That typically happens when either:
  • your server command event handlers are catching and discarding Indy exceptions without letting the server handle them internally, so it doesn't know when clients are no longer valid so it can stop their threads.  At the very least, if you catch exceptions in your code, you should re-raise any EIdException-derived exception you catch (except in the OnException and OnListenException events, of course).
  • you encounter a deadlock within an event handler, causing the calling thread to not fully terminate.

(10-24-2018, 05:04 PM)bluewwol Wrote: By my speculation my error should be in my configuration of the component

No.  The config is fine.

(10-24-2018, 05:04 PM)bluewwol Wrote: OR in my component exception handlers

The handlers you have shown are fine in general.  Though, you don't need to call Disconnect() in the OnException event, the server will do that for you after the event handler exits.  And the PeerIP is not valid in the OnListenException event, as that event is for a listening socket, not a connected client socket.

(10-24-2018, 05:04 PM)bluewwol Wrote: OR in the component disconnect event

That handler is fine.

(10-24-2018, 05:04 PM)bluewwol Wrote: I am hoping I have missed something stupid and some fresh eyes might see the obvious,

Nothing obvious that I see. You are just going to have to debug your code to find out what is actually happening. For instance, are you getting an OnDisconnect event triggered for every client that connects? Under normal conditions, you should be.

Reply


Messages In This Thread
TIdSmtpServer not freeing threads - by bluewwol - 10-24-2018, 05:04 PM
RE: TIdSmtpServer not freeing threads - by rlebeau - 10-24-2018, 06:48 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)