Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TidSmtpServer Stops responding
#5
(11-10-2018, 12:30 AM)bluewwol Wrote: The OnListenException is still being triggered fairly frequently, however with the try .. excepts removed Indy handles the problem and keeps on ticking.  So my app is now functional over time now.

It wasn't just about removing try..except blocks, but about fixing your code to stop accessing things in the incorrect way.

(11-10-2018, 12:30 AM)bluewwol Wrote: As to the cause of the exceptions, I will let it run over the weekend and review on Monday, however a comonality on all of these exceptions is that have occured this afternoon is that Indy shows the AThread.Binding.PeerIP to be ''.  In my judgement this appears to be a consequence of questionable probing of the IP??

Again, you are mixing up LISTEN threads with CLIENT threads.  They are TWO DIFFERENT THINGS.  A listen thread accepts a client on a listening port and spawns a NEW THREAD to manage that client, then goes back to accept the next client on the port.  So, there is no Peer on a LISTEN thread, so of course AThread.Binding.PeerIP will always be blank, as AThread.Binding represents a listening socket, not a client socket.

(11-10-2018, 12:30 AM)bluewwol Wrote: right now I am logging this, no longer interfering with Indy handling the exception and the world continues function as expected.

Maybe try something more like this:

Code:
// OnException event handler
procedure TdSmtpServ.WwolSmtpServException(AContext: TIdContext; AException: Exception);
var
 Ctx: TmySmtpItem;
 CtxId: string;
begin
 Ctx := TmySmtpItem(AContext.Data);
 if Ctx <> nil then CtxId := IntToStr(Ctx.Id);

 Log(now, 0, -4, AContext.Binding.IP, AContext.Binding.PeerIP, '[' + CtxId + '] - ' + 'WwolSmtpServ Client EXCEPTION',
   '[' + CtxId + '] - ' +
   ' - Peer IP: ' + AContext.Binding.PeerIP +
   ' - Binding IP: ' + AContext.Binding.IP +
   ' - EXCEPTION: ' + AException.ClassName + ' - ' + AException.Message);

 if Ctx <> nil then
   Ctx.LastEvent := 'WwolSmtpServException ' + AException.ClassName + ' - ' + AException.Message;
end;

// OnListenException event handler
procedure TdSmtpServ.WwolSmtpServListenException(AThread: TIdListenerThread; AException: Exception);
begin
 Log(now, 0, -9, AThread.Binding.IP, '', 'WwolSmtpServ Listen EXCEPTION',
   ' - Binding IP: ' + AThread.Binding.IP +
   ' - EXCEPTION: ' + AException.ClassName + ' - ' + AException.Message);
end;

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: 1 Guest(s)