[reSIProcate] AbstractFifo bug?

Derek MacDonald derek at xten.com
Thu May 19 13:20:04 CDT 2005


Can you get a stack trace this? AbstractFifo is used a lot in resip, but it
does have several subclasses.  The size is incremeneted in the add methods
of the subclasses, which lock before adding. 

 

Also, run resiprocate/test/testFifo.cxx on your configuration.

 

--Derek

 

PS -- What is your platform/compiler?

 

CONFIDENTIALITY NOTICE

This email and any files transmitted with it contains proprietary
information and, unless expressly stated otherwise, all contents and
attachments are confidential. This email is intended for the addressee(s)
only and access by anyone else is unauthorized. If you are not an addressee,
any disclosure, distribution, printing or copying of the contents of this
email or its attachments, or any action taken in reliance on it, is
unauthorized and may be unlawful. If you are not an addressee, please inform
the sender immediately and then delete this email and any copies of it.
Thank you for your co-operation.

  _____  

From: resiprocate-devel-bounces at list.sipfoundry.org
[mailto:resiprocate-devel-bounces at list.sipfoundry.org] On Behalf Of Micky
Kaufmann
Sent: Thursday, May 19, 2005 6:31 AM
To: resiprocate-devel at list.sipfoundry.org
Subject: [reSIProcate] AbstractFifo bug?

 

Hi. All

 

While running repro I go an assert error from the AbstractFifo::getNext
method:

 

void* AbstractFifo::getNext() {

   Lock lock(mMutex); (void)lock;

 

   while (mFifo.empty())

   {

      mCondition.wait(mMutex);

   }

   void* firstMessage = mFifo.front();

   mFifo.pop_front();

   assert(mSize != 0);

   mSize--;

   return firstMessage;

}

 

As I see it the problem is caused probably because non thread safe adding of
elements to the Fifo. Meaning mSize++ is missing somewhere and from what I
investigated the only reason for using mSize instead of using
std::deque::size is because we want to make sure that mSize < mMaxSize.

Is there another reason?

 

Is it ok to replace the lines:

   assert(mSize != 0);

   mSize--;

with

   mSize = mFifo.size();

 

Is it ok to replace the line:

   while (mFifo.empty())

with

   while (mSize==0)  //this.empty()

 

Any other solution?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20050519/ceaf0c3e/attachment.htm>


More information about the resiprocate-devel mailing list