Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TidSmtpServer Stops responding
#3
(11-09-2018, 06:35 PM)bluewwol Wrote: The addition of a try except block in my onConnect event

If an exception occurs in the OnConnect event, you are logging it, but then you are discarding it. Don't do that. Re-raise the exception and let the server handle it so the client can be disconnected.

Alternatively, get rid of the try...except altogether, and do your error logging in the OnException event instead, which is triggered whenever an uncaught exception occurs in a client thread.

BTW, Indy has a TIdThreadSafeInteger class (and Int64 and Cardinal variants) in the IdThreadSafe unit. You could replace your unique_id variables with that class, and then get rid of SenderCS.

(11-09-2018, 06:35 PM)bluewwol Wrote: and removed the 
TmySmtpItem(AThread.Data).LastEvent := 'WwolSmtpServListenException ' + AException.ClassName + ' - ' + AException.message;
statement from the onListenException event.

In the OnListenException event, the AThread.Data property is nil (unless you assign your own Data object in the OnBeforeListenerRun event). That event is triggered whenever an uncaught exception occurs in a listener thread, not in a client thread. Your TmySmtpItem objects are not assigned to listener threads, they are assigned to client contexts own by client threads. So, in the OnListenerException event, AThread.Data will NEVER point to a TmySmtItem object, and as such TmySmtpItem(AThread.Data).Id and TmySmtpItem(AThread.Data).Id are invalid.

Now, why the OnListenException event would be triggered at all, is a different matter that you still need to debug. Just fix your logging to not access invalid data fields.

Reply


Messages In This Thread
TidSmtpServer Stops responding - by bluewwol - 11-09-2018, 02:36 PM
RE: TidSmtpServer Stops responding - by bluewwol - 11-09-2018, 06:35 PM
RE: TidSmtpServer Stops responding - by rlebeau - 11-09-2018, 08:42 PM
RE: TidSmtpServer Stops responding - by bluewwol - 11-10-2018, 12:30 AM
RE: TidSmtpServer Stops responding - by rlebeau - 11-12-2018, 07:19 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)