< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate] Stack Overflow exception with TransactionUser TimeLimitFifo


Hi,

I have a (.NET) application that contains my own TransactionUser subclass.
Much like DUM, it loops, waiting for new messages in mFifo:

   int MessageController::event_thread()
   {
      while ( !this->mShutdown )
      {
         Message* msg=0;

         if ((msg = mFifo.getNext(100)) != 0)
         {
                ...
         }
      }
   }

(The body of my TransactionUser thread (the ... part) basically ends up
calling callback functions, sending responses to incoming requests, and
sending outgoing requests and responses.)

The problem: When I set the timeout value to 100 ms for the
mFifo.getNext(100) call, I get a stack overflow exception at the following
line after about an hour of letting my app run:

>From TimeLimitFifo.hxx:
template <class Msg>
Msg*
TimeLimitFifo<Msg>::getNext(int ms)
{
// !!!! EXCEPTION HERE !!!!
   std::auto_ptr<Timestamped>
tm(static_cast<Timestamped*>(AbstractFifo::getNext(ms)));
   if (tm.get())
   {
      return tm->mMsg;
   }
   else
   {
      return 0;
   }
}

If I increase the timeout value to, say 1500ms, then my app will run for
more than an hour without any problems (I'm currently just in the process of
leaving it run overnight to see if it will eventually still get the stack
overflow exception).  If I (foolishly) decrease the value to 1ms, then I get
the stack overflow after just a few minutes.

Note that I've also created a (simple) .NET softphone (completely separate
from the app I'm having problems with) based on DUM and it does NOT appear
to have this problem after an hour (even though I've noticed that DUM uses
the same 100ms timeout value when it calls mFifo.getNext(100) ).

Just wondering if anyone has any thoughts on this?

Thanks,
 - Jeremy -

Jeremy Geras
Software Developer,
NewHeights Software
(250) 380-0584
jgeras@xxxxxxxxxxxxxx