List Info

Thread: possible error




possible error
user name
2006-08-30 23:50:14
hello.... I made an application based on opal some time ago
, and this app 
runs with many calls, 300 simultaneous calls aprox,  but,
I have some core dumps when some calls come quickly, one of
these core dumps 
are generated by IsE164(aliases[i]), under h323pdu.cxx in
H323SignalPDU::SetQ931Fields method. I have many core dumps
at the same 
line, and I have similiar minidumps on windows platform.

a complete back trace in linux is (the error is this line  
"info->lastElement =
info->lastElement->next;", info->lastElement
point to 
NULL under linux and wrong pointer under windows)

BOOL PAbstractList::SetCurrent(PINDEX index) const
     {
       if (index >= GetSize())
         return FALSE;

       if (info->lastElement == NULL ||
info->lastIndex >= GetSize() ||
           index < info->lastIndex/2 || index > 
(info->lastIndex+GetSize())/2) {
         if (index < GetSize()/2) {
           info->lastIndex = 0;
           info->lastElement = info->head;
         }
         else {
           info->lastIndex = GetSize()-1;
           info->lastElement = info->tail;
         }
       }

      while (info->lastIndex < index) {
		info->lastElement = info->lastElement->next;
//<<<<<<<=================== 
ERROR HERE info->lastElement point to NULL under linux
and wrong pointer 
under windows
        info->lastIndex++;
       }

       while (info->lastIndex > index) {
         info->lastElement =
info->lastElement->prev;
         info->lastIndex--;
       }

       return TRUE;

(gdb) bt
#0  0xb7e3dd96 in PAbstractList::SetCurrent (this=0x8ce7c94,
index=1)
    at ../common/collect.cxx:751
#1  0xb7e3e2b4 in PAbstractList::GetAt (this=0x8ce7c94,
index=1)
    at ../common/collect.cxx:667
#2  0xb7e443e5 in PAbstractList::GetReferenceAt
(this=0x8ce7c94, index=1)
    at contain.inl:445
#3  0x080adf84 in PList<PString>::operator[]
(this=0x8ce7c94, index=1)
    at lists.h:452
#4  0xb7826ee9 in H323SignalPDU::SetQ931Fields
(this=0xb4931c60,
    connection=0x8ce7700, insertPartyNumbers=0, plan=1,
type=0,
    presentation=-1, screening=-1) at
/ivr/opal/src/h323/h323pdu.cxx:1518 
<---------------- ERROR HERE
#5  0xb7827844 in H323SignalPDU::BuildCallProceeding
(this=0xb4931c60,
    connection=0x8ce7700) at
/ivr/opal/src/h323/h323pdu.cxx:917
#6  0xb7809734 in H323Connection::OnReceivedSignalSetup
(this=0x8ce7700,
    setupPDU=0xb4933958) at
/ivr/opal/src/h323/h323.cxx:2234
#7  0xb77fb6ea in H323Connection::HandleSignalPDU
(this=0x8ce7700,
    pdu=0xb4933958) at /ivr/opal/src/h323/h323.cxx:1933
#8  0xb77f2be3 in H323EndPoint::NewIncomingConnection
(this=0x833c760,
    transport=0xb5a7f0a0) at
/ivr/opal/src/h323/h323ep.cxx:1232
#9  0xb73d1a19 in OpalEndPoint::ListenerCallback
(this=0x833c760,
    param=-1247285088) at
/ivr/opal/src/opal/endpoint.cxx:303
#10 0xb73d2d15 in
OpalEndPoint::ListenerCallback_PNotifier::Call (
    this=0xb6402d60, note=0x8c5d688,
extra=-1247285088) at endpoint.h:262
---Type <return> to continue, or q <return> to
quit---
#11 0x080ad7fc in PNotifier::operator() (this=0x8c5d6dc, 
notifier=0x8c5d688,
    extra=-1247285088) at notifier.h:99
#12 0xb7e3300c in PSimpleThread::Main (this=0x8c5d688)
    at ../common/osutils.cxx:2303
#13 0xb7e154d9 in PThread::PX_ThreadStart (arg=0x8c5d688) at

tlibthrd.cxx:1340
#14 0xb703a341 in start_thread () from
/lib/tls/i686/cmov/libpthread.so.0
#15 0xb6d004ee in clone () from /lib/tls/i686/cmov/libc.so.6


the condition race is in the aliases collection,  at the
frame #4

void H323SignalPDU::SetQ931Fields(const H323Connection &
connection,
                                  BOOL insertPartyNumbers,
                                  unsigned plan,
                                  unsigned type,
                                  int presentation,
                                  int screening)
{
  PINDEX i;
  const PStringList & aliases =
connection.GetLocalAliasNames();

  PString localName = connection.GetLocalPartyName();
  PString displayName = connection.GetDisplayName();
  PString number;

  if (IsE164(localName)) {
    number = localName;
    if (displayName.IsEmpty()) {
      for (i = 0; i < aliases.GetSize(); i++) {
        if (!IsE164(aliases[i])) { <-- *********** ERROR
HERE one time  
****************
          displayName = aliases[i];
          break;
        }
      }
    }
  }
  else {
    if (!localName && displayName.IsEmpty())
      displayName = localName;
    for (i = 0; i < aliases.GetSize(); i++) {
      if (IsE164(aliases[i])) { <-- *********** ERROR
HERE mostly the time 
****************
        number = aliases[i];
        break;
      }
    }
  }

  if (displayName.IsEmpty())
    displayName = number;
  q931pdu.SetDisplayName(displayName);

  if (insertPartyNumbers) {
    PString otherNumber = connection.GetRemotePartyNumber();
    if (otherNumber.IsEmpty()) {
      PString otherName = connection.GetRemotePartyName();
      if (IsE164(otherName))
        otherNumber = otherName;
    }

    if (connection.HadAnsweredCall()) {
      if (!number)
        q931pdu.SetCalledPartyNumber(number, plan, type);
      if (!otherNumber)
        q931pdu.SetCallingPartyNumber(otherNumber, plan,
type, presentation, 
screening);
    }
    else {
      if (!number)
        q931pdu.SetCallingPartyNumber(number, plan, type,
presentation, 
screening);
      if (!otherNumber)
        q931pdu.SetCalledPartyNumber(otherNumber, plan,
type);
    }
  }

  unsigned ring = connection.GetDistinctiveRing();
  if (ring != 0)
    q931pdu.SetSignalInfo((Q931::SignalInfo)(ring + 
Q931::SignalAlertingPattern0));
}

I put a pmutex in the function that touch the aliases
collection, but It did 
not work....., I donīt know where are the aliases collection
added or 
deleted, how can I make the aliases collection thread safe
or something 
similar?


------------------------------------------------------------
------------
Check the FAQ before asking! - http://www.
openh323.org/~openh323/fom.cgi
The OpenH323 Project mailing list, using Mailman. To
unsubscribe or
change your subscription options, goto
htt
p://www.openh323.org/mailman/listinfo/openh323
Maintained by Quicknet Technologies, Inc - http://www.quicknet.net
------------------------------------------------------------
------------
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )