[OpenSIPStack] FW: FW: Memory Leak in Proxy and Full Mode
Brought to you by:
joegenbaclor
From: Gustavo C. <cur...@ho...> - 2008-06-26 13:27:38
|
Hi Joegen I found something really weird. If I change the order of headers in SIPMessage::Cleanup() the memory leak varies. For example, if I clean m_AllowList and m_ViaList first of all the memory leak decrease: void SIPMessage::Cleanup(){ GlobalLock(); if( m_AllowList != NULL ){ delete m_AllowList; m_AllowList = NULL; } /// special headers if( m_ViaList != NULL ){ delete m_ViaList; m_ViaList = NULL; } ..... I will continue searching. ¿Is there a way to configure PMEMORY_CHECK for release? Thanks for your help. Gustavo Curetti From: cur...@ho...To: jo...@op...; joe...@gm...; ope...@li...Subject: RE: [OpenSIPStack] FW: Memory Leak in Proxy and Full ModeDate: Mon, 23 Jun 2008 21:42:45 +0200 Hi Joegen I think this is a memory leak because after all messages are sent the memory never go down.The code added in B2BUserAgent::Registrar::ProcessUpperRegKeepAlive() waits 5 seconds and sends the first Invite, then waits 5 seconds , sends the second Invite, waits 5 seconds more and finally sends 4998 Invites with a 40 ms delay between each one. void B2BUserAgent::Registrar::ProcessUpperRegKeepAlive(){ DWORD delay = 5000; DWORD numberOfPackets = 0; while( !m_UpperRegSync.Wait( delay ) ) { if(numberOfPackets < 5000) { OString testRequest = "INVITE sip:5435155555@192.168.0.5:5060 SIP/2.0\r\nContact: <sip:4284623@192.168.0.10:5060>\r\nCSeq: 101 INVITE\r\nFrom: <sip:4284623@192.168.0.10>;tag=5A3745C-2418\r\nTo: <sip:55555555@192.168.0.206>\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: <sip:192.168.0.206:5060;lr>\r\nAllow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO\r\nUser-Agent: Cisco-SIPGateway/IOS-12.x\r\nCall-Id: " + OString(numberOfPackets) + "@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: <sip:4284623@192.168.0.10>;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 << "<<< " << msg->GetStartLine() << " " << " SRC: " << addrStr << ":" << portStr << ":UDP" << " enc=" << msg->IsEncrypted() << " bytes=1103"; OStringStream strPacket; strPacket << *msg; 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 ) ); if (numberOfPackets > 1) delay = 40; numberOfPackets++; } }} The SIP timers B and H are set to 20 ms. #define SIP_TIMER_B 20 #define SIP_TIMER_H 20 After all messages are sent, I wait for a long time but the memory used doesn't decrease. I tried different settings: Case 1 5 sec -> 1 Invite -> 5 sec -> 1 Invite -> 5 sec -> 4998 Invite (40 ms) -> 5 min1)Mem Usage 8332k 8940k 9080k 9400k2)Mem Usage 8364k 8952k 8976k 9416k3)Mem Usage 8300k 8888k 8908k 9368k Case 2 5 sec -> 1 Invite -> 5 sec -> 1 Invite -> 5 sec -> 9998 Invite (40 ms) -> 5 min1)Mem Usage 8308k 8900k 9000k 9696k2)Mem Usage 8320k 8908k 8928k 9760k The leak is bigger when the amount of messages are higher.Case 3 5 sec -> 1 Invite -> 5 sec -> 1 Invite -> 5 sec -> 4998 Invite (30 ms) -> 5 min1)Mem Usage 8252k 8832k 8852k 9532k 2)Mem Usage 8256k 8844k 8872k 9536k Case 4 5 sec -> 1 Invite -> 5 sec -> 1 Invite -> 5 sec -> 4998 Invite (20 ms) -> 5 min1)Mem Usage 8276k 8864k 8884k 9728k 2)Mem Usage 8240k 8828k 8848k 9728k The leak is bigger when the delay is shorter. Case 5 5 sec -> 1 Invite -> 5 sec -> 1 Invite -> 5 sec -> 4998 Invite (80 ms) -> 5 min1)Mem Usage 8344k 8932k 8952k 9332k2)Mem Usage 8376k 8968k 8992k 9276k The only type of error in the log is : 102:42:36.691 ERR: [CID=0x0000] UDP Socket Read Error (Socket not connected) in case 1 appears 5219 times. I don't know if this error is linked with the leak. The log is attached. This behavior doesn't seem to be because of transactions waiting for timers. Maybe is because some type of conflict with shared resources or mutexs, but I really don't know. Any idea? If you need more info, please let me know. One more thing, I suggest to increase MAX_SIP_MESSAGE_LENGTH because i had problems with Invites with a lot of headers (record-routes, vias, etc) and long bodies. #define MAX_SIP_MESSAGE_LENGTH 2048 ----> #define MAX_SIP_MESSAGE_LENGTH 4000 Thanks for your help. Gustavo Curetti > Date: Sat, 21 Jun 2008 10:17:22 +0800> To: cur...@gm...> From: joe...@gm...> CC: joe...@gm...; ope...@li...> Subject: Re: [OpenSIPStack] FW: Memory Leak in Proxy and Full Mode> > Hi Gustavo,> > This time, I am not sure if what you are seeing in perfmon is actually a > leak or simply transactions waiting for timers to fire so it could > transition from Completed to Terminated state. I tried to fire the same > in my perfmon and the private mem leveled at around 80 in the graph. > Same place where yours leveled to a straight line. Can you share more > info why you think this is a leak?> > Joegen> > > Gustavo Curetti wrote:> > Hi Joegen,> > > > Another case of memory leak is attached. (no debugging mode).> > I send 5000 messages with 40 ms delay between each message.> > A jpg of the perfmon is attached too. (Private Bytes)> > > > Thanks for your help> >> > Gustavo Curetti> >> >> > ------------------------------------------------------------------------> >> > > Date: Fri, 20 Jun 2008 09:33:12 +0800> > > To: cur...@gm...; ope...@li...> > > From: joe...@gm...> > > CC: joe...@gm...> > > Subject: Re: [OpenSIPStack] FW: Memory Leak in Proxy and Full Mode> > >> > > Right! Patch is in CVS.> > >> > > Joegen> > >> > > Gustavo Curetti wrote:> > > > Hi Joegen,> > > >> > > > Thanks for your help. The other header which is missing in the > > SIPMessage::CleanUp() is the m_SessionExpires ("session-expires"). I > > will continue with my tests and let you know.> > > >> > > > Gustavo> > > >> > > >> > > >> > >> > >> > > > > -------------------------------------------------------------------------> > > 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> > > ope...@li...> > > https://lists.sourceforge.net/lists/listinfo/opensipstack-devel> >> >> > ------------------------------------------------------------------------> > ¿Aburrido? Ingresá ya y divertite como nunca en MSN Juegos. MSN Juegos > > <http://juegos.ar.msn.com/>> > ------------------------------------------------------------------------> >> > 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> ope...@li...> https://lists.sourceforge.net/lists/listinfo/opensipstack-devel Descargá GRATIS el poder del nuevo Internet Explorer 7. Internet Explorer 7 _________________________________________________________________ Ingresá ya a MSN en Concierto y disfrutá los recitales en vivo de tus artistas favoritos. http://msninconcert.msn.com/music/archive/es-la/archive.aspx |