Subject ProcessPassiveTasks
Author tigaris
I was wondering if this procedure MUST be called at some point, or
if it unnecessary. The timer within TIB_Session that calls this
routine keeps causing low-level RTL exceptions (i.e. cannot be
trapped with try..except).

I believe it is a threading problem related to nature of my
application, which is a free-threaded COM server that manages its
own connection pool. Each TIB_Connection I create creates its own
TIB_Session component, so the default session is not used.

Because it is a free-threaded com server, threads are constantly
being created and destroyed. Each thread will grab a connection
from the connection pool (creating one if none are available), so
the connections/sessions need to be happy running on any arbitrary
thread.

Any session created on the main thread (which occasionally happens
within my own timers) automatically creates a timer that calls this
ProcessPassiveTasks. Under heavy load, it only a matter of time
before the server will crash as that routine is obviously not thread-
safe.

I cannot stop the automatic creation of this timer without modifying
the source code (thank you open source!). I suppose I could set the
TimerInterval property of the session to 0 immediately after
creation, but I do not like the existence of any window for a server
crash.

I have tried changing my connection pool to prevent com worker
threads from using connections created on the main thread, and while
this did lessen the problem, it did not go away. The only thing
that has worked is completely disabling the session timer under all
conditions.

So now we come back to my original question. Now that I have
permanently disabled the session timer, ProcessPassiveTasks will
never be called. Is this a bad thing?

If it must be called manually from within my own timer, does it
matter what thread the session was created on? Does it need to be
called for all active sessions, or just one? Is it perhaps only
necessary if I was using TIB_Events (which I am not)?

Thank you for your time and assitance on this matter.

Luke Tigaris
Chief Technical Officer
PowerLaw, Inc.