[OpenSIPS-Devel] [ opensips-Bugs-2950939 ] memory leak while accessing REGISTER contact uri

SourceForge.net noreply at sourceforge.net
Tue Feb 16 12:02:38 CET 2010


Bugs item #2950939, was opened at 2010-02-13 01:09
Message generated for change (Settings changed) made by bogdan_iancu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=2950939&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: 1.6.x
>Status: Closed
Resolution: Fixed
Priority: 3
Private: No
Submitted By: eugene (evereta)
Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
Summary: memory leak while accessing REGISTER contact uri

Initial Comment:
Hello,

We are running out of package memory while processing REGISTER messages. We narrowed down the leak to accessing uri of the contact header of the message: $(ct{nameaddr.uri}). Originally our script was xlog-ing some value and then adding a Contact header to the reply constructed from the contact uri of the request plus expires parameters, but we have confirmed that memory leaks even if all we do is xlog contact uri - please see our config file below.

After some number of requests (usually 50,000 - 80,000) we start getting these errors and no more requests get processed:

2010 Feb 10 02:55:08 <local0.err> tb1(Equinix) /usr/sbin/opensips[6646]: ERROR:core:parse_headers: pkg memory allocation failed
2010 Feb 10 02:55:08 <local0.err> tb1(Equinix) /usr/sbin/opensips[6646]: ERROR:core:build_res_buf_from_sip_req: parse_headers failed
2010 Feb 10 02:55:08 <local0.err> tb1(Equinix) /usr/sbin/opensips[6646]: ERROR:sl:sl_send_reply_helper: response building failed

Another observation that we had is that when we access the entire contact header, for example: xlog("L_INFO", "Contact: $ct;expires=3600\n");. then leak does not occur.

Attached is a sipp scenario we use to re-create the leak. We usually run 2-3 sipp sessions in parallel with this command:
sipp 192.168.1.33 -s vasya.pupkin -sf register1.xml -m 40000


Opensips config file is as follows:

#
# $Id: opensips.cfg 5503 2009-03-22 16:22:32Z bogdan_iancu $
#
# OpenSIPS basic configuration script
#     by Anca Vamanu <anca at voice-system.ro>
#
# Please refer to the Core CookBook at:
#      http://www.opensips.org/index.php?n=Resources.DocsCookbooks
# for a explanation of possible statements, functions and parameters.
#


####### Global Parameters #########

debug=3
fork=yes
children=8

dns=off
rev_dns=off
disable_tcp=yes
log_stderror=no
log_facility=LOG_LOCAL0

port=5060
listen=udp:192.168.1.33:5060

server_signature=no

####### Modules Section ########

#set module path
mpath="/usr/lib64/opensips/modules/"

loadmodule "sl.so"
loadmodule "textops.so"
loadmodule "xlog.so" 

# ----------------- setting module-specific parameters ---------------

route
{
	xlog("L_INFO", "Contact: <$(ct{nameaddr.uri})>;expires=3600\n"); 
#	xlog("L_INFO", "Contact: $ct;expires=3600\n"); 
	sl_send_reply("200", "OK");
	exit;
}


Thanks,
Eugene

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

>Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2010-02-16 13:02

Message:
That is correct - thanks for the fix.

I also did the backport to stable versions.

Thanks and regards,
Bogdan

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

Comment By: eugene (evereta)
Date: 2010-02-15 22:54

Message:
Hi, Bogdan.

I compiled the trunk and it had problems with Contact headers with
parameters (Contacts without params were fine). I diff'ed and synch'ed to
the current svn version - new file is attached. You missed a memset, and it
doesn't work without it.

With that correction, it runs clean.

Regards & thanks for your help,
Eugene

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

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2010-02-15 13:34

Message:
Hi Eugene,

Your patch, with some additional fixes / improvements is on SVN trunk (see
rev 6604) - I would really appreciate if you could test the fix again
before porting to stable version.

Thanks and regards,
Bogdan

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

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2010-02-15 11:40

Message:
Hi Eugene,

Indeed, that seams to be true and the fix looks valid. Let me review it
and upload it on svn.

Thanks and regards,
Bogdan

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

Comment By: eugene (evereta)
Date: 2010-02-13 04:06

Message:
I've attached a proposed fix for transformations.c - please have a look

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

Comment By: eugene (evereta)
Date: 2010-02-13 02:19

Message:
Looks like the leak occurs because contact uri has parameters. 



More information about the Devel mailing list