threading and exception problems in tidSMTPserver

Giganews Newsgroups
Subject: threading and exception problems in tidSMTPserver
Posted by:  nd (no@spam.com)
Date: Thu, 28 Apr 2005

Hi,

I'm having a few problems with a tidSMTPserver based app: (D6, indy 10.0.52)

Sometimes, when receiving large emails, the tidSMTPserver raises a 10053
exception when a client gives up and times out during the process.

problem is, this exception seems to go unhandled in the thread, and in fact
causing the entire app to terminate. I thought the indy framework should
catch this? Any workarounds?

Another issue:  is there a known bug with LockList?
In my main thread I'm doing something like this:

  Trlist:=SMTPserver.Contexts.LockList;
  try
    NumThreads:=trlist.Count;
    For trIx:=0 to NumThreads-1 do begin
    try
      obj:=tObject(trlist.Items[trIx]);
    { do thing with obj } ***** exceptions here  *****
    except
      { error logging }
    end;
    end;
  finally
    SMTPserver.Contexts.UnlockList;
  end;

sometimes, not very often, I get exceptions as pointed out in the code. It
seems to me that "obj"  doesn't point to a valid TidSMTPserverContext at the
time. I was wondering if the index variable (trIx) was getting out of bounds
despite the locklist....

I understand there is a known bug causing exceptions in TerminateAllThreads
(triggered when doing SMTPserver.Active:=false). In fact my humble debugging
indicates, that problem is similar to mine: exceptions are raised in
TerminateAllThreads - caused by faulty object pointers inside
Locklist/UnlocklList.

Any ideas are welcome, please...

Replies