While I won’t say the ASN code is completely bug free (a debugged program is merely on for which the failing condition has not yet been found) it is also highly unlikely to be the source of your problem. The last bug was found in July, 2004!

 

What does tend to happen is the ASN code does a LOT of small memory allocations so is extremely susceptible to heap corruption. However the act of corrupting the heap could, unfortunately, be ANYWHERE. And at risk of causing offense, the most likely place is in your code. After all a lot of people use H323plus and even more use PTLib and are not seeing this crash.

 

This type of problem is notoriously difficult to find. The reason is that the crash point can have absolutely nothing to do with the cause of the crash which is in a completely different function and possibly even different TIME. The only way to fix them is divine inspiration and very good coding practices. The most common reasons are the “dangling pointer” and the “uninitialized pointer”. If you don’t know those terms go find a textbook and a better university.

 

Robert.

 

From: h323plus-bounces@lists.packetizer.com [mailto:h323plus-bounces@lists.packetizer.com] On Behalf Of mohammad alam
Sent: Friday, 30 May 2008 12:01 AM
To: H323plus
Cc: cheersalam@yahoo.co.in
Subject: [h323plus] Crash in Ptlib...........

 

Simon

After 8-10th times of placing and ending call (without restarting
application) my Application crashes in ptlib in file asner.cxx at line 2079
(Below at line no.6 for your reference)
Crashes are at both Local and Remote side on same line


1  PASN_Choice & PASN_Choice::operator=(const PASN_Choice & other)
2  {
3   if (&other == this) // Assigning to ourself, just do nothing.
4     return *this;
5
6   if(choice!=NULL)
7   {
8       delete choice;
9       choice = NULL;
10   }
11
12   PASN_Object::operator=(other);
13
14   numChoices = other.numChoices;
15   names = other.names;
16   namesCount = other.namesCount;
17
18   if (other.CheckCreate())
19     choice = (PASN_Object *)other.choice->Clone();
20   else
21     choice = NULL;
22
23   return *this;
24 }



I am using this in my Loadcapabilities function for H.263 CIF Image Size

     capabilities.RemoveAll();        //called only once
     AddAllCapabilities(0, 0, "*");     //called only once
     AddAllUserInputCapabilities(0, 1); //called only once

     preferenceorder.AppendString

(H263_CIF);
     preferenceorder.AppendString(H263_QCIF);
     preferenceorder.AppendString(H263_4CIF);
     preferenceorder.AppendString(H263_16CIF);
     preferenceorder.AppendString(H261_CIF);
     preferenceorder.AppendString(H261_QCIF);
     SetVideoFrameSize(H323Capability::cifMPI);
capabilities.Reorder(preferenceorder);

The last few lines of PTRACE are

 2:26.027   H225 Calle...er:22641e8 H225  Handling PDU: Connect
callRef=11394
 2:26.027  H225 Calle...er:22641e8 H225  Set protocol version to 6 and
implying H.245 version 13
 2:26.027  H225 Calle...er:22641e8 H225  Set remote party name: "admin"
 2:26.027  H225 Calle...er:22641e8 H225  Set remote application name: "
VCS   1.0.0 (H323plus v1.20beta3)   9/61"
 2:26.027  H225 Calle...er:22641e8 H225  Received connect PDU.
 2:26.027  H225 Calle...er:22641e8 H323TCP     Connecting to
10.8.4.144:1412 (local port=0)
 2:26.038  H225 Calle...er:22641e8 H323TCP     SetOption(IP_TOS) failed:
Invalid argument
 2:26.038  H225 Calle...er:22641e8 H323TCP     Started connection:
host=10.8.4.144:1412, if=10.8.4.148:2717, handle=1280
 2:26.038  H225 Calle...er:22641e8 H225  Fast Start FALSE fastStartState
FastStartDisabled
 2:26.038  H225 Calle...er:22641e8 H245  Handle control channel
 2:26.038  H225 Calle...er:22641e8 H245  Start control negotiations
 2:26.038  H225 Calle...er:22641e8 H245  Sending TerminalCapabilitySet:
outSeq=1
 2:26.038  H245:6f3ff60      H245  Started thread
 2:26.038  H245:6f3ff60      H245  Handle control channel
 2:26.038  H245:6f3ff60      H245  Start control negotiations

CRASH..>>>>>>>>>>>>>>>>>>>>>>


This crash is consistent. Crashes anytime after 5th call..
Your comments are needed.
Where I am going wrong.....

Alam

Regards
Mohammad Alam