11 Replies Last post: Dec 15, 2008 11:28 AM by Guest  
Guest

Jun 18, 2008 8:50 PM

[OpenSIPStack] FW: Memory Leak in Proxy and Full Mode

Guest
1. Jun 18, 2008 8:50 PM in response to: Guest
Re: [OpenSIPStack] FW: Memory Leak in Proxy and Full Mode
Right! I've found m_MinSE is not getting deleted in
SIPMessage::CleanUp(). Patched this in CVS.

Joegen

Gustavo Curetti wrote:
Hi Joegen

The modification doesn't solve the memory issues. I continue searching
for the memory leak.

A new case is attached and this one appear too when debugging with
Microsot Visual.

Originally, i sent the attached Invite every 250 ms and I set the
timer B and H in 20 ms:

#define SIP_TIMER_B 20

#define SIP_TIMER_H 20

Then I change the code
of B2BUserAgent::Registrar::ProcessUpperRegKeepAlive()
for making easier to replicate the leak:

void B2BUserAgent::Registrar::ProcessUpperRegKeepAlive()
{
while( !m_UpperRegSync.Wait( 250 ) )
{
OString testRequest =
"INVITE sip:5435155555@192.168.0.5:5060 SIP/2.0\r\nContact:
\r\nCSeq: 101 INVITE\r\nFrom:
;tag=5A3745C-2418\r\nTo:
\r\nVia: SIP/2.0/UDP
192.168.0.206:5060;branch=z9hG4bK63028de3a6b7743a\r\nVia: SIP/2.0/UDP
192.168.0.10:5060\r\nRecord-Route:
\r\nAllow: INVITE, OPTIONS, BYE, CANCEL,
ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO\r\nUser-Agent:
Cisco-SIPGateway/IOS-12.x\r\nCall-Id:
3738EB25-278011DD-B92F90A6-C0EF6BE3@192.168.0.10\r\nMax-Forwards
:
6\r\nExpires: 180\r\nContent-Length: 235\r\ndate: Thu, 22 May 2008
21:52:32 GMT\r\nsupported: timer\r\nmin-se: 1800\r\ncisco-guid:
926237238-662704605-3106705574-3236916195\r\nremote-party-id:
;party=calling;screen=no;privacy=off\r\ntimestamp:
1211493152\r\nallow-events: telephone-event\r\ncontent-type:
application/sdp\r\n\r\nv=0\r\no=CiscoSystemsSIP-GW-UserAgent 7402 717
IN IP4 192.168.0.10\r\ns=SIP Call\r\nc=IN IP4 192.168.0.10\r\nt=0
0\r\nm=audio 19298 RTP/AVP 0 19\r\nc=IN IP4 192.168.0.10\r\na=rtpmap:0
PCMU/8000\r\na=rtpmap:19 CN/8000\r\na=ptime:20";
testRequest = ParserTools::LineFeedSanityCheck( testRequest );
SIPMessage * msg = new SIPMessage( testRequest );

OString addrStr = "192.168.0.147";
OString portStr = "10000";
SIPHeader rcvAddr( "RCVADDR", addrStr );
SIPHeader rcvPort( "RCVPORT", portStr );
SIPHeader rcvTran( "RCVTRAN", "udp" );

msg->AddInternalHeader( rcvAddr );
msg->AddInternalHeader( rcvPort );
msg->AddInternalHeader( rcvTran );
msg->SetInterfaceAddress( "192.168.0.202" );
msg->SetInterfacePort( 5070 );

OStringStream traceStream;

traceStream << "<<< "
GetStartLine() << " "
<< " SRC: " << addrStr << ":" << portStr << ":UDP"
<< " enc=" IsEncrypted()
<< " bytes=1103";

OStringStream strPacket;
strPacket COMPOUND_LOG_CONTEXT( LogInfo(), msg->GetCallId(),
traceStream.str(), LogDebugHigh(), strPacket );

SIPTransport::NotifyRead( traceStream.str() );

if( msg->IsInvite() )
{
SIPMessage * trying = new SIPMessage();
msg->CreateResponse( *trying, SIPMessage::Code100_Trying );
Via via;
msg->GetViaAt(0, via );
if( via.IsBehindNAT() )
{
SIPURI srcURI;
srcURI.SetHost(addrStr);
srcURI.SetPort(portStr);
trying->SetSendAddress(srcURI);
}
if( msg->IsEncrypted() )
trying->SetEncryption( TRUE );
GetTransportManager()->ProcessOutbound( trying );
}

GetTransportManager()->OnTransportEvent(
new SIPTransportEvent(
msg,
SIPTransportEvent::UDPPacketArrival
) );

/*///process the keep alives here
for( PINDEX i = 0; i {
SIPMessage reg;
if( GetRegistrationDB().GetRegistration( i, reg ) )
{
if( reg.HasInternalHeader( "upper-reg" ) )
{
/// this is an upper reg, send a keep-alive
/// Check the last via if its from a private IP
Via via;
if( reg.GetViaAt( reg.GetViaSize() - 1, via ) )
{
if( via.IsBehindNAT() )
{
SIPURI target;
target.SetHost( via.GetReceiveAddress().AsSTLString() );
target.SetPort( via.GetRPort() );
SIPMessage keepAlive;
RequestLine requestLine;
requestLine.SetMethod( "KEEP-ALIVE" );
requestLine.SetRequestURI( target );
keepAlive.SetStartLine( requestLine );
GetUserAgent().TransportWrite( keepAlive );
}
}
}
}
}*/
}
}

The OpenSBC is in "Proxy Only Mode" and the configuration is in
"OpenSBC.reg" (attached).

I compile the OpenSBC in Microsoft Visual C++ 2005 obtaining the exe
attached.

Any idea?

Thanks for your help.

Gustavo



Date: Thu, 5 Jun 2008 14:18:35 +0800
To: curetti dot gustavo at gmail dot com
Subject: Re: [OpenSIPStack] FW: Memory Leak in Proxy and Full Mode
From: joegen dot baclor at gmail dot com

Hi Gustavo,

Yes, i'm able to replicate it. For some reason, the code I #ifdefed in
AppendVia() below is causing it. Let me know if it solves your issues.
I've tried looking at what its doing but nothing is evident as to
why it
would leak. If you find something, let me know

Joegen

BOOL SIPMessage::AppendVia(
const Via & header
)
{
GlobalLock();

ParseViaList();

if( m_ViaList == NULL )
{
m_ViaList = new Via::Collection();
m_ViaList->Append( new Via( header ) );
}else
{

#if 0 // For some reason, this sanity check is leaking mem
/// sanity check
if( m_ViaList->GetSize() > 0 )
{
Via & topVia = (*m_ViaList)[0];

SIPURI topViaURI = topVia.GetURI();

SIPURI newURI = header.GetURI();

if( SIPTransport::IsTheSameAddress( topViaURI, newURI, TRUE ) )
return FALSE;
}
#endif

///we append it on top
Via::Collection oldViaList = *m_ViaList;
oldViaList.MakeUnique();
delete m_ViaList;

m_ViaList = new Via::Collection();
m_ViaList->Append( new Via( header ) );

for( PINDEX i = 0; i > m_ViaList->Append( new Via( oldViaList[i] ) );

m_ViaList->MakeUnique();
}

return TRUE;
}

Gustavo Curetti wrote:


Hi Joegen

The destructor is called. The problem seem to be the headers like
Via,
RecordRoute, Contact, Allow, Supported (List headers).

The leak is very easy to reproduce. I change the code of
B2BUserAgent::Registrar::ProcessUpperRegKeepAlive:

void B2BUserAgent::Registrar::ProcessUpperRegKeepAlive()
{
while( !m_UpperRegSync.Wait( 10 ) )
{

SIPMessage * msg = new SIPMessage();

msg->AppendVia(Via("SIP/2.0/UDP 192.168.0.10:5060"));
msg->AppendVia(Via("SIP/2.0/UDP

192.168.0.206:5060;branch=z9hG4bK440fdc3e04de9d10;rport=5060;received=192.168.0.206"));
msg->AppendRecordRoute(RouteURI(""));
msg->AppendContact(ContactURI(""));
msg->AppendAllow(Allow("INVITE, ACK, CANCEL, OPTIONS, BYE, REFER,
SUBSCRIBE, NOTIFY"));
msg->AppendSupported(Supported("replaces"));

delete msg;
}
}

I compile the OpenSBC in Microsoft Visual C++ 2005 obtaining the exe
attached.
I execute "OpenSBC Debug" in Windows 2003 or Windows 2000 and the

leak
is there.

I put traces and SIPMessage::~SIPMessage(), SIPMessage::Cleanup() are
called.

Any idea?

Thanks for your help.

Gustavo



Date: Mon, 2 Jun 2008 10:19:08 +0800
To: curetti dot gustavo at gmail dot com;
opensipstack-devel at lists dot sourceforge dot net
From: joegen dot baclor at gmail dot com
Subject: Re: [OpenSIPStack] FW: Memory Leak in Proxy and Full Mode

Try putting a trace before and after the "delete" statement to
be sure
that its getting called. From what i see, assuming that SIPMessage
destructor performs proper cleanup, that a leak here can only be
caused
by an exception occurring in the SIPMessage constructor;

Gustavo Curetti wrote:
Hi Joegen:

The memory leak is hard to find. I send the 200 OK repeatedly but
the memory leak doesn't appear if i'm debugging with Microsot Visual
2005, but the leak appears if i'm running the OpenSBC like a service.

If I comment:

void SIPStack::EnqueueTransportWriteEvent(
const SIPMessage & message,
SIPTransportEvent::Type eventType
)
{
if( m_IsTerminating )
return;

/*SIPMessage * msg = new SIPMessage(message);

msg->SetInternalHeader( "TRN-ID",

msg->GetTransactionId().AsString());
m_TransportManager->EnqueueEvent( new SIPTransportEvent( msg,
eventType ) );*/
}

there is not leak. But if I modify the code like this:

void SIPStack::EnqueueTransportWriteEvent(


const SIPMessage & message,
SIPTransportEvent::Type eventType
)
{
if( m_IsTerminating )
return;

SIPMessage * msg = new SIPMessage(message);

/*msg->SetInternalHeader( "TRN-ID",
msg->GetTransactionId().AsString());
m_TransportManager->EnqueueEvent( new SIPTransportEvent( msg,
eventType ) );*/
delete msg;
}

the leak shows up. I don't understand why this happens if I'm
deleting the msg.
What i said in the last mail about CSeq is not seem to be the
reason.
Any idea? Thanks for your help.
Gustavo

From: curetti_gustavo@hotmail.comSubject: RE: [OpenSIPStack]

Memory Leak in Proxy and Full ModeDate: Fri, 30 May 2008 17:04:37
+0200


Hi Joegen: I found that the memory leak is when you create a
SIPMessage from other SIPMessage or from a OString and then you
delete
de message. In the case of the 200 Ok the message is created in:
ProxySessionManager::OnOrphanedMessage()SIPUserAgent::TransportWrite()SIPStack::EnqueueTransportWriteEvent(){SIPMessage

* msg = new SIPMessage(message); The memory leak is because the CSeq
header. If i comment : SIPMessage::SIPMessage(const SIPMessage &
msg)SIPMessage & SIPMessage::operator=(const SIPMessage & msg)void
SIPMessage::AssignContents(SIPMessage & msg){ /*if( m_CSeq != NULL )
msg.m_CSeq = static_cast(m_CSeq->Clone());*/} There is no more
memory leak. I try to replace: SIPMessage * msg = new
SIPMessage(message); ----> SIPMessage * msg = new
SIPMessage(message.AsString()); but the memory leak still exist
unless
i comment: void SIPMessage::Finalize(){ /*if( m_CSeq == NULL ) {
m_CSeq = new CSeq( h ); }*/} That's what i found so far. Gustavo


Date: Fri, 30 May 2008 11:26:11 +0800> To:
curetti dot gustavo at gmail dot com; opensipstack-devel at lists dot sourceforge dot net>
Subject: Re: [OpenSIPStack] Memory Leak in Proxy and Full Mode> From:
joegen dot baclor at gmail dot com> > Hi Gustavo,> > Take a look at void
ProxySession::OnFinalResponse( SIPMessage & message > ) method. Can
you verify if the object created in:> > manager.CreateTuple(
m_OriginalInvite, m_RoutedInvite, 10 );> > Actually expires after 10
seconds?> > Putting a breakpoint at
ProxySessionTupleManager::Tuple::~Tuple() should > be enough to
confirm it.> > Also by any chance, did you accidentally think that
this tuple is the > mem leak because it was created after the
transaction?> > Joegen> > > Gustavo Curetti wrote:> > Hi Joegen> >

I found a memory leak when the OpenSBC is configured in Proxy or Full
mode. When i send a 200 Ok for example in B2B mode there is no memory
leak, but when i send a 200 ok in Proxy or Full mode, some memory is
taken and never released. I attach the logs. The OpenSBC
(192.168.0.202:5070) is running under Windows.> > > > Thanks for your
help> > > > Gustavo> >
_________________________________________________________________> >
Ingresá ya a MSN Deportes y enterate de las últimas novedades del
mundo deportivo.> > http://msn.foxsports.com/fslasc/> >
------------------------------------------------------------------------>
------------------------------------------------------------------------->

This SF.net email is sponsored by: Microsoft> > Defy all
challenges.
Microsoft(R) Visual Studio 2008.> >
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/> >
------------------------------------------------------------------------>
_______________________________________________> >
opensipstack-devel mailing list> >
opensipstack-devel at lists dot sourceforge dot net> >
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel> >

------------------------------------------------------------------------>
No virus found in this incoming message.> > Checked by AVG. > >
Version: 7.5.524 / Virus Database: 269.24.1/1463 - Release Date:
5/23/2008 3:36 PM> > > >

Ingresá ya a MSN en Concierto y disfrutá los recitales en vivo de
tus artistas favoritos. MSN en Concierto
_________________________________________________________________
Descargá ya gratis y viví la experiencia Windows Live.
http://www.descubrewindowslive.com/latam/index.html

This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel




This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel


Descargá ya gratis y viví la experiencia Windows Live. Descubre
Windows Live <http://www.descubrewindowslive.com/latam/index.html>


Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.524 / Virus Database: 269.24.1/1463 - Release Date:
5/23/2008 3:36 PM


Ingresá ya a MSN Deportes y enterate de las últimas novedades del
mundo deportivo. MSN Deportes <http://msn.foxsports.com/fslasc/>


Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.524 / Virus Database: 269.24.1/1463 - Release Date: 5/23/2008 3:36 PM



Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel
Guest
2. Jun 18, 2008 9:02 PM in response to: Guest
Re: [OpenSIPStack] FW: Memory Leak in Proxy and Full Mode
Hi Gustavo,

I've been tracking this issue in assembla. Feel free to create an
account in the tracker so you could comment on the status of the leak.

http://www.assembla.com/spaces/opensbc/tickets/22

Joegen

Joegen E. Baclor wrote:
Right! I've found m_MinSE is not getting deleted in
SIPMessage::CleanUp(). Patched this in CVS.

Joegen

Gustavo Curetti wrote:

Hi Joegen

The modification doesn't solve the memory issues. I continue searching
for the memory leak.

A new case is attached and this one appear too when debugging with
Microsot Visual.

Originally, i sent the attached Invite every 250 ms and I set the
timer B and H in 20 ms:

#define SIP_TIMER_B 20

#define SIP_TIMER_H 20

Then I change the code
of B2BUserAgent::Registrar::ProcessUpperRegKeepAlive()
for making easier to replicate the leak:

void B2BUserAgent::Registrar::ProcessUpperRegKeepAlive()
{
while( !m_UpperRegSync.Wait( 250 ) )
{
OString testRequest =
"INVITE sip:5435155555@192.168.0.5:5060 SIP/2.0\r\nContact:
\r\nCSeq: 101 INVITE\r\nFrom:
;tag=5A3745C-2418\r\nTo:
\r\nVia: SIP/2.0/UDP
192.168.0.206:5060;branch=z9hG4bK63028de3a6b7743a\r\nVia: SIP/2.0/UDP
192.168.0.10:5060\r\nRecord-Route:
\r\nAllow: INVITE, OPTIONS, BYE, CANCEL,
ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO\r\nUser-Agent:
Cisco-SIPGateway/IOS-12.x\r\nCall-Id:
3738EB25-278011DD-B92F90A6-C0EF6BE3@192.168.0.10\r\nMax-Forwards
:
6\r\nExpires: 180\r\nContent-Length: 235\r\ndate: Thu, 22 May 2008
21:52:32 GMT\r\nsupported: timer\r\nmin-se: 1800\r\ncisco-guid:
926237238-662704605-3106705574-3236916195\r\nremote-party-id:
;party=calling;screen=no;privacy=off\r\ntimestamp:
1211493152\r\nallow-events: telephone-event\r\ncontent-type:
application/sdp\r\n\r\nv=0\r\no=CiscoSystemsSIP-GW-UserAgent 7402 717
IN IP4 192.168.0.10\r\ns=SIP Call\r\nc=IN IP4 192.168.0.10\r\nt=0
0\r\nm=audio 19298 RTP/AVP 0 19\r\nc=IN IP4 192.168.0.10\r\na=rtpmap:0
PCMU/8000\r\na=rtpmap:19 CN/8000\r\na=ptime:20";
testRequest = ParserTools::LineFeedSanityCheck( testRequest );
SIPMessage * msg = new SIPMessage( testRequest );

OString addrStr = "192.168.0.147";
OString portStr = "10000";
SIPHeader rcvAddr( "RCVADDR", addrStr );
SIPHeader rcvPort( "RCVPORT", portStr );
SIPHeader rcvTran( "RCVTRAN", "udp" );

msg->AddInternalHeader( rcvAddr );
msg->AddInternalHeader( rcvPort );
msg->AddInternalHeader( rcvTran );
msg->SetInterfaceAddress( "192.168.0.202" );
msg->SetInterfacePort( 5070 );

OStringStream traceStream;

traceStream << "<<< "
GetStartLine() << " "
<< " SRC: " << addrStr << ":" << portStr << ":UDP"
<< " enc=" IsEncrypted()
<< " bytes=1103";

OStringStream strPacket;
strPacket > COMPOUND_LOG_CONTEXT( LogInfo(), msg->GetCallId(),
traceStream.str(), LogDebugHigh(), strPacket );

SIPTransport::NotifyRead( traceStream.str() );

if( msg->IsInvite() )
{
SIPMessage * trying = new SIPMessage();
msg->CreateResponse( *trying, SIPMessage::Code100_Trying );
Via via;
msg->GetViaAt(0, via );
if( via.IsBehindNAT() )
{
SIPURI srcURI;
srcURI.SetHost(addrStr);
srcURI.SetPort(portStr);
trying->SetSendAddress(srcURI);
}
if( msg->IsEncrypted() )
trying->SetEncryption( TRUE );
GetTransportManager()->ProcessOutbound( trying );
}

GetTransportManager()->OnTransportEvent(
new SIPTransportEvent(
msg,
SIPTransportEvent::UDPPacketArrival
) );

/*///process the keep alives here
for( PINDEX i = 0; i > {
SIPMessage reg;
if( GetRegistrationDB().GetRegistration( i, reg ) )
{
if( reg.HasInternalHeader( "upper-reg" ) )
{
/// this is an upper reg, send a keep-alive
/// Check the last via if its from a private IP
Via via;
if( reg.GetViaAt( reg.GetViaSize() - 1, via ) )
{
if( via.IsBehindNAT() )
{
SIPURI target;
target.SetHost( via.GetReceiveAddress().AsSTLString() );
target.SetPort( via.GetRPort() );
SIPMessage keepAlive;
RequestLine requestLine;
requestLine.SetMethod( "KEEP-ALIVE" );
requestLine.SetRequestURI( target );
keepAlive.SetStartLine( requestLine );
GetUserAgent().TransportWrite( keepAlive );
}
}
}
}
}*/
}
}

The OpenSBC is in "Proxy Only Mode" and the configuration is in
"OpenSBC.reg" (attached).

I compile the OpenSBC in Microsoft Visual C++ 2005 obtaining the exe
attached.

Any idea?

Thanks for your help.

Gustavo


Date: Thu, 5 Jun 2008 14:18:35 +0800
To: curetti dot gustavo at gmail dot com
Subject: Re: [OpenSIPStack] FW: Memory Leak in Proxy and Full Mode
From: joegen dot baclor at gmail dot com

Hi Gustavo,

Yes, i'm able to replicate it. For some reason, the code I #ifdefed in
AppendVia() below is causing it. Let me know if it solves your issues.
I've tried looking at what its doing but nothing is evident as to
why it

would leak. If you find something, let me know

Joegen

BOOL SIPMessage::AppendVia(
const Via & header
)
{
GlobalLock();

ParseViaList();

if( m_ViaList == NULL )
{
m_ViaList = new Via::Collection();
m_ViaList->Append( new Via( header ) );
}else
{

#if 0 // For some reason, this sanity check is leaking mem
/// sanity check
if( m_ViaList->GetSize() > 0 )
{
Via & topVia = (*m_ViaList)[0];

SIPURI topViaURI = topVia.GetURI();

SIPURI newURI = header.GetURI();

if( SIPTransport::IsTheSameAddress( topViaURI, newURI, TRUE ) )
return FALSE;
}
#endif

///we append it on top
Via::Collection oldViaList = *m_ViaList;
oldViaList.MakeUnique();
delete m_ViaList;

m_ViaList = new Via::Collection();
m_ViaList->Append( new Via( header ) );

for( PINDEX i = 0; i >> m_ViaList->Append( new Via( oldViaList[i] ) );

m_ViaList->MakeUnique();
}

return TRUE;
}

Gustavo Curetti wrote:

Hi Joegen

The destructor is called. The problem seem to be the headers like
Via,

RecordRoute, Contact, Allow, Supported (List headers).

The leak is very easy to reproduce. I change the code of
B2BUserAgent::Registrar::ProcessUpperRegKeepAlive:

void B2BUserAgent::Registrar::ProcessUpperRegKeepAlive()
{
while( !m_UpperRegSync.Wait( 10 ) )
{

SIPMessage * msg = new SIPMessage();

msg->AppendVia(Via("SIP/2.0/UDP 192.168.0.10:5060"));
msg->AppendVia(Via("SIP/2.0/UDP

192.168.0.206:5060;branch=z9hG4bK440fdc3e04de9d10;rport=5060;received=192.168.0.206"));

msg->AppendRecordRoute(RouteURI(""));
msg->AppendContact(ContactURI(""));
msg->AppendAllow(Allow("INVITE, ACK, CANCEL, OPTIONS, BYE, REFER,
SUBSCRIBE, NOTIFY"));
msg->AppendSupported(Supported("replaces"));

delete msg;
}
}

I compile the OpenSBC in Microsoft Visual C++ 2005 obtaining the exe
attached.
I execute "OpenSBC Debug" in Windows 2003 or Windows 2000 and the

leak

is there.

I put traces and SIPMessage::~SIPMessage(), SIPMessage::Cleanup() are
called.

Any idea?

Thanks for your help.

Gustavo



Date: Mon, 2 Jun 2008 10:19:08 +0800
To: curetti dot gustavo at gmail dot com;
opensipstack-devel at lists dot sourceforge dot net

From: joegen dot baclor at gmail dot com
Subject: Re: [OpenSIPStack] FW: Memory Leak in Proxy and Full Mode

Try putting a trace before and after the "delete" statement to
be sure

that its getting called. From what i see, assuming that SIPMessage
destructor performs proper cleanup, that a leak here can only be
caused

by an exception occurring in the SIPMessage constructor;

Gustavo Curetti wrote:

Hi Joegen:

The memory leak is hard to find. I send the 200 OK repeatedly but
the memory leak doesn't appear if i'm debugging with Microsot Visual
2005, but the leak appears if i'm running the OpenSBC like a service.

If I comment:

void SIPStack::EnqueueTransportWriteEvent(
const SIPMessage & message,
SIPTransportEvent::Type eventType
)
{
if( m_IsTerminating )
return;

/*SIPMessage * msg = new SIPMessage(message);

msg->SetInternalHeader( "TRN-ID",

msg->GetTransactionId().AsString());

m_TransportManager->EnqueueEvent( new SIPTransportEvent( msg,
eventType ) );*/

}

there is not leak. But if I modify the code like this:

void SIPStack::EnqueueTransportWriteEvent(

const SIPMessage & message,
SIPTransportEvent::Type eventType
)
{
if( m_IsTerminating )
return;

SIPMessage * msg = new SIPMessage(message);

/*msg->SetInternalHeader( "TRN-ID",

msg->GetTransactionId().AsString());

m_TransportManager->EnqueueEvent( new SIPTransportEvent( msg,
eventType ) );*/

delete msg;
}

the leak shows up. I don't understand why this happens if I'm
deleting the msg.

What i said in the last mail about CSeq is not seem to be the
reason.

Any idea? Thanks for your help.
Gustavo

From: curetti_gustavo@hotmail.comSubject: RE: [OpenSIPStack]

Memory Leak in Proxy and Full ModeDate: Fri, 30 May 2008 17:04:37
+0200

Hi Joegen: I found that the memory leak is when you create a
SIPMessage from other SIPMessage or from a OString and then you
delete

de message. In the case of the 200 Ok the message is created in:

ProxySessionManager::OnOrphanedMessage()SIPUserAgent::TransportWrite()SIPStack::EnqueueTransportWriteEvent(){SIPMessage

* msg = new SIPMessage(message); The memory leak is because the CSeq
header. If i comment : SIPMessage::SIPMessage(const SIPMessage &
msg)SIPMessage & SIPMessage::operator=(const SIPMessage & msg)void
SIPMessage::AssignContents(SIPMessage & msg){ /*if( m_CSeq != NULL )
msg.m_CSeq = static_cast(m_CSeq->Clone());*/} There is no more
memory leak. I try to replace: SIPMessage * msg = new
SIPMessage(message); ----> SIPMessage * msg = new
SIPMessage(message.AsString()); but the memory leak still exist
unless

i comment: void SIPMessage::Finalize(){ /*if( m_CSeq == NULL ) {
m_CSeq = new CSeq( h ); }*/} That's what i found so far. Gustavo


Date: Fri, 30 May 2008 11:26:11 +0800> To:
curetti dot gustavo at gmail dot com; opensipstack-devel at lists dot sourceforge dot net>
Subject: Re: [OpenSIPStack] Memory Leak in Proxy and Full Mode> From:
joegen dot baclor at gmail dot com> > Hi Gustavo,> > Take a look at void
ProxySession::OnFinalResponse( SIPMessage & message > ) method. Can
you verify if the object created in:> > manager.CreateTuple(
m_OriginalInvite, m_RoutedInvite, 10 );> > Actually expires after 10
seconds?> > Putting a breakpoint at
ProxySessionTupleManager::Tuple::~Tuple() should > be enough to
confirm it.> > Also by any chance, did you accidentally think that
this tuple is the > mem leak because it was created after the
transaction?> > Joegen> > > Gustavo Curetti wrote:> > Hi Joegen> >

I found a memory leak when the OpenSBC is configured in Proxy or Full
mode. When i send a 200 Ok for example in B2B mode there is no memory
leak, but when i send a 200 ok in Proxy or Full mode, some memory is
taken and never released. I attach the logs. The OpenSBC
(192.168.0.202:5070) is running under Windows.> > > > Thanks for your
help> > > > Gustavo> >
_________________________________________________________________> >
Ingresá ya a MSN Deportes y enterate de las últimas novedades del
mundo deportivo.> > http://msn.foxsports.com/fslasc/> >

------------------------------------------------------------------------>

------------------------------------------------------------------------->

This SF.net email is sponsored by: Microsoft> > Defy all
challenges.

Microsoft(R) Visual Studio 2008.> >
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/> >

------------------------------------------------------------------------>

_______________________________________________> >
opensipstack-devel mailing list> >
opensipstack-devel at lists dot sourceforge dot net> >
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel> >

------------------------------------------------------------------------>

No virus found in this incoming message.> > Checked by AVG. > >
Version: 7.5.524 / Virus Database: 269.24.1/1463 - Release Date:
5/23/2008 3:36 PM> > > >

Ingresá ya a MSN en Concierto y disfrutá los recitales en vivo de
tus artistas favoritos. MSN en Concierto

_________________________________________________________________
Descargá ya gratis y viví la experiencia Windows Live.
http://www.descubrewindowslive.com/latam/index.html



This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel



This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel



Descargá ya gratis y viví la experiencia Windows Live. Descubre
Windows Live <http://www.descubrewindowslive.com/latam/index.html>



Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.524 / Virus Database: 269.24.1/1463 - Release Date:
5/23/2008 3:36 PM


Ingresá ya a MSN Deportes y enterate de las últimas novedades del
mundo deportivo. MSN Deportes <http://msn.foxsports.com/fslasc/>


Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.524 / Virus Database: 269.24.1/1463 - Release Date: 5/23/2008 3:36 PM


Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel



Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel
Guest
3. Dec 6, 2008 11:07 AM in response to: Guest
[OpenSIPStack] OSBC <==> sipX Send-Reg-NO
Hi Joegen

In the Sip-trunk config i have selected

Send-Reg=NO

I am using Broadvox wholesale, which means i have 2 SIP TRUNK'1

One for Termination x.x.x.10
One for Orgination x.x.x.20

I do not need username and password settings in and maybe
if i knew what Transient was used for*

In light of these facts How should the Sip-Trunk Configure be setup or
constructed and what is the bear minimum needed?

r



SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel
Guest
4. Dec 9, 2008 3:06 PM in response to: Guest
Re: [OpenSIPStack] libpt_linux_x86_r_s.a ERROR
Guest
5. Dec 9, 2008 3:06 PM in response to: Guest
Re: [OpenSIPStack] libpt_linux_x86_r_s.a ERROR
Hi Joegen

download CVS opensipstack and opensbc
./confgure opensipstack then opensbc
In the opensbc do make bothnoshared

I reinstalled a fresh copy of CVS to see if this would fix the Listener
***Error*** and ran into this problem

No rule to make libpt_linux_x86_r_s.a

What is this error?

r



SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel
Guest
6. Dec 10, 2008 9:38 AM in response to: Guest
Re: [OpenSIPStack] libpt_linux_x86_r_s.a ERROR
Hi Robert,

You need to compile OpenSIPStack first and then OpenSBC. You error
indicates that the library file is missing.

Joegen
voice wrote:
Hi Joegen

download CVS opensipstack and opensbc
./confgure opensipstack then opensbc
In the opensbc do make bothnoshared

I reinstalled a fresh copy of CVS to see if this would fix the Listener
***Error*** and ran into this problem

No rule to make libpt_linux_x86_r_s.a

What is this error?

r



SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel
Guest
7. Dec 10, 2008 10:27 AM in response to: Guest
Re: [OpenSIPStack] Error ***Address already in use***** 2
Hi Anyone

How do i fix Error ***Address already in use***** in the User Agent
Name/Listener address?

Your instruction were very clear about the possible causes. But other then
several instances of OSBC what else could cause this problem. I get this
***error** in both NIC's viewed from the OSBC Transport Status. Does the
OSBC see the sipX install or does OSBC see the Linux network settings or is
it reading something twice?

r



SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel
Click to view ehernaez's profile   67 posts since
Aug 28, 2007
8. Dec 10, 2008 11:47 AM in response to: Guest
Re: [OpenSIPStack] Error ***Address already in use***** 2

Hi Robert,

By default, OSBC will listen to pot 5060 of all IP addresses configured on the box . If SIPX (or any opther application) is listening on port 5060 as well, then OSBC will detect it and give the error you have encountered. To avoid this, just configure OSBC to listen on a specific port and IP address. You can do this in the General Parameters > Interface Address section. For example, you can set it to listen to sip : 10.0.0.1 : 5060 which will cause it to use that IP address and port only.

As a general rule, if you are going to run SIPX and OSBC on the same box, it simplifies things to have two IP address (each plumbed to a separate NIC) and to force each application to listen only on its allocated IP address.

HTH

Guest
9. Dec 10, 2008 2:39 PM in response to: ehernaez
Re: [OpenSIPStack] Error ***Address already in use***** 2
Hi HTH

Thanks for observations.

I set in sipX Gateway/DialPlan too listen on :5080

i set OSBC to listen on :5060 in osbc NIC1 pointing to OSBC ipaddr ==
69.x.x.50
i set OSBC to listen on :5080 in osbc NIC2 pointing to sipX ipaddr ==
69.x.x.100
also in the B2BUA and UpperRegistration settings.

Both nics share the same public network 69.x.x./24. Do you mean they should
not share but run on different networks like 40.x.x.x and 69.x.x.x?

NIC2 shows NO more **ERROR** now running on port:5080

but

NIC1 still shows Error ***Address already in use*****

You know the guy who said he got OSBC and sipX on one box to work should
have run into the same problem. If you are listening please pipe up.

I set B2BUA to pass To and From 5060 to 5080 vis versa.
I set Upper Registration from sip:* to :5080

How does OSBC sense sipX use of Ports? maybe i can un-sense it? kidding....

r

Original Message

From: "OpenSIPStack Forum"
To:
Sent: Wednesday, December 10, 2008 10:47 AM
Subject: Re: [OpenSIPStack] Error ***Address already in use***** 2


Hi Robert,

By default, OSBC will listen to pot 5060 of all IP addresses configured

on the box . If SIPX (or any opther application) is listening on port
5060 as well, then OSBC will detect it and give the error you have
encountered. To avoid this, just configure OSBC to listen on a specific
port and IP address. You can do this in the General Parameters &gt;
Interface Address section. For example, you can set it to listen to sip :
10.0.0.1 : 5060 which will cause it to use that IP address and port only.


As a general rule, if you are going to run SIPX and OSBC on the same box,
it simplifies things to have two IP address (each plumbed to a separate NIC)
and to force each application to listen only on its allocated IP address.


HTH


--------------------------------------------------------------------------

----
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel
Guest
10. Dec 15, 2008 11:26 AM in response to: ehernaez
Re: [OpenSIPStack]OSBC <==> sipX Error ***Address already in use***** 2
Hi Joegen

Is there a way for OSBC to turn off if from grabing all port:5060 and just
have it grab the NIC:5060 that it has been manually set to in the Admin
Param's?

It seems that OSBC is grabing all the ports reguardless of of ipaddr
settings in a duel NIC box. It does not matter is if set each NIC to same
or different network addresses. I have tried to isolate OSBC and sipX from
each other by manually seting the OSBC only to NIC1. This i believe should
isloated the second NIC2 which is set to be used by sipX. OSBC and sipX
both want to default to port:5060 for interal to both reasons.

I have set OSBC to B2BusUpperRegister and. In this mode OSBC is passing
registration and B2Bua is routing inbound calls to sipX. Why does it still
want to manage all port:5060? Shouldn't manually setting NIC1 also shield
NIC2 and applications using that NIC from OSBC?

In sipX's config.defs defaults proxy setting is port:5060 and i have
manually set MY_IP_ADDDR to ip of NIC2. This isolate the 2nd NIC1 from
NIC2.

OSBC still see's NIC2 and sipX and it's port:5060 settings.

Could you please contact the guy who said he has OSBC and sipX running on
the same box using 2 NIC's using Public addressing and ask him to publish
his settings. There is something missing, a trick that is not immediately
clear. OSBC is not documented and i guess the only way to get documentation
is to buy Solegy but then that defeats the reason for this OpenSource. Also
if both NIC's are set to public addressing then remote phones don't need to
go through OSBC UpperRegistation to register the UA to sipX. And in this
configuration i believe OSBC is broken. when calls are coming in from ITSP
because there is no UA hy-jacking of registration, right?

Your explanation below assumes that OSBC is configured to talk to an PSTN
and not a ITSP (Internet SIP Trunk). ITSP:5060 and can't be ask to rewrite
their gateway to listen on some other port. OSBC is setting between ITSP
and sipX. Thus. ITSP:5060 <==> 5060:OSBC:5060 <==> 5060:sipX:5060 <==>
5060:UA.

I have tried ITSP:5060 <==> 5060:OSBC:6060 <==> 6060:sipX:6060 <==> 6060:UA
also but sipX fails even when remote phones are using sip port:6060 and
something is gettign lost when making and recieving calls going thru sipX
when it is NOT set port:5060.

OSBC and sipX use additional progressive SIP related ports that may also
overlap with OSBC which normally would not be a problem if OSBCdid not grab
all ports:5060 and their direvitives like 5062, 5064 etc...

OSBC should key in on NIC's and not PORTs. Is there a way to toggle OSBC
off from looking beyound it's own Relm?

t


Original Message

From: "OpenSIPStack Forum"
To:
Sent: Wednesday, December 10, 2008 10:47 AM
Subject: Re: [OpenSIPStack] Error ***Address already in use***** 2


Hi Robert,

By default, OSBC will listen to pot 5060 of all IP addresses configured

on the box . If SIPX (or any opther application) is listening on port
5060 as well, then OSBC will detect it and give the error you have
encountered. To avoid this, just configure OSBC to listen on a specific
port and IP address. You can do this in the General Parameters &gt;
Interface Address section. For example, you can set it to listen to sip :
10.0.0.1 : 5060 which will cause it to use that IP address and port only.


As a general rule, if you are going to run SIPX and OSBC on the same box,
it simplifies things to have two IP address (each plumbed to a separate NIC)
and to force each application to listen only on its allocated IP address.


HTH


--------------------------------------------------------------------------

----
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel
Guest
11. Dec 15, 2008 11:28 AM in response to: ehernaez
Re: [OpenSIPStack] OSBC<==> Error ***Address already in use***** 2
Hi Joegen

Is there a way for OSBC to turn off if from grabing all port:5060 and just
have it grab the NIC:5060 that it has been manually set to in the Admin
Param's?

It seems that OSBC is grabing all the ports reguardless of of ipaddr
settings in a duel NIC box. It does not matter is if set each NIC to same
or different network addresses. I have tried to isolate OSBC and sipX from
each other by manually seting the OSBC only to NIC1. This i believe should
isloated the second NIC2 which is set to be used by sipX. OSBC and sipX
both want to default to port:5060 for interal to both reasons.

I have set OSBC to B2BusUpperRegister and. In this mode OSBC is passing
registration and B2Bua is routing inbound calls to sipX. Why does it still
want to manage all port:5060? Shouldn't manually setting NIC1 also shield
NIC2 and applications using that NIC from OSBC?

In sipX's config.defs defaults proxy setting is port:5060 and i have
manually set MY_IP_ADDDR to ip of NIC2. This isolate the 2nd NIC1 from
NIC2.

OSBC still see's NIC2 and sipX and it's port:5060 settings.

Could you please contact the guy who said he has OSBC and sipX running on
the same box using 2 NIC's using Public addressing and ask him to publish
his settings. There is something missing, a trick that is not immediately
clear. OSBC is not documented and i guess the only way to get documentation
is to buy Solegy but then that defeats the reason for this OpenSource. Also
if both NIC's are set to public addressing then remote phones don't need to
go through OSBC UpperRegistation to register the UA to sipX. And in this
configuration i believe OSBC is broken. when calls are coming in from ITSP
because there is no UA hy-jacking of registration, right?

Your explanation below assumes that OSBC is configured to talk to an PSTN
and not a ITSP (Internet SIP Trunk). ITSP:5060 and can't be ask to rewrite
their gateway to listen on some other port. OSBC is setting between ITSP
and sipX. Thus. ITSP:5060 <==> 5060:OSBC:5060 <==> 5060:sipX:5060 <==>
5060:UA.

I have tried ITSP:5060 <==> 5060:OSBC:6060 <==> 6060:sipX:6060 <==> 6060:UA
also but sipX fails even when remote phones are using sip port:6060 and
something is gettign lost when making and recieving calls going thru sipX
when it is NOT set port:5060.

OSBC and sipX use additional progressive SIP related ports that may also
overlap with OSBC which normally would not be a problem if OSBCdid not grab
all ports:5060 and their direvitives like 5062, 5064 etc...

OSBC should key in on NIC's and not PORTs. Is there a way to toggle OSBC
off from looking beyound it's own Relm?

t


Original Message

From: "OpenSIPStack Forum"
To:
Sent: Wednesday, December 10, 2008 10:47 AM
Subject: Re: [OpenSIPStack] Error ***Address already in use***** 2


Hi Robert,

By default, OSBC will listen to pot 5060 of all IP addresses configured

on the box . If SIPX (or any opther application) is listening on port
5060 as well, then OSBC will detect it and give the error you have
encountered. To avoid this, just configure OSBC to listen on a specific
port and IP address. You can do this in the General Parameters &gt;
Interface Address section. For example, you can set it to listen to sip :
10.0.0.1 : 5060 which will cause it to use that IP address and port only.


As a general rule, if you are going to run SIPX and OSBC on the same box,
it simplifies things to have two IP address (each plumbed to a separate NIC)
and to force each application to listen only on its allocated IP address.


HTH


--------------------------------------------------------------------------

----
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
opensipstack-devel mailing list
opensipstack-devel at lists dot sourceforge dot net
https://lists.sourceforge.net/lists/listinfo/opensipstack-devel