[OpenSIPS-Devel] [ opensips-Bugs-3063966 ] deadlock in send_publish()

SourceForge.net noreply at sourceforge.net
Sat Sep 11 11:53:24 CEST 2010


Bugs item #3063966, was opened at 2010-09-11 01:10
Message generated for change (Settings changed) made by neutrino38
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3063966&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: modules
Group: 1.5.x
>Status: Closed
>Resolution: Wont Fix
Priority: 8
Private: No
Submitted By: Emmanuel BUU (neutrino38)
Assigned to: Nobody/Anonymous (nobody)
Summary: deadlock in send_publish()

Initial Comment:
Hello, we discovered a bug in OpenSIPS 1.5.3 : when using pua_usrloc OpenSIPS hangs when processing REGISTER messages if a certain scenario
is executed;

launch the UA (cause it to register Ok)
stop the UA (cause it to unregister)
launch the UA again (register hangs)

I wonder if this could be related to issue 3044051.

See traces, script extract and stack in comments


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

Comment By: Emmanuel BUU (neutrino38)
Date: 2010-09-11 11:45

Message:
I checked that on 1.6.3, this bug has been fixed already. So I guess that
as 1.5.x branch is frozen, this will not be changed in the code. Correct?

Emmanuel BUU
http://www.ives.fr/

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

Comment By: Emmanuel BUU (neutrino38)
Date: 2010-09-11 11:38

Message:
Here is a fix proposal

---
/home/ebuu/rpmbuild/BUILD/opensips-1.5.3-tls/modules/pua/send_publish.c	2009-08-23
16:12:46.000000000 +0400
+++ send_publish.c	2010-09-11 13:33:09.000000000 +0400
@@ -275,6 +275,8 @@
 			lock_get(&HashT->p_records[presentity->hash_index].lock);
 			lock_get(&presentity->publ_lock);
 			delete_htable(presentity);
+			/* IVeS - deadlock fix */
+			lock_release(&HashT->p_records[presentity->hash_index].lock);
 			goto done;
 		}

Can the module maintained validate this?

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

Comment By: Emmanuel BUU (neutrino38)
Date: 2010-09-11 01:37

Message:
In pua/send_publish.c at line 602 there is the following comment:

       /* The lock for the sent Publish remains taken until the reply is
received
        * and the record is updated

Could it be that when the record is deleted because publ->expires == 0,
the lock would never be released ?

Then the next publish on the same presentity would lock as illustrated by
the stack ?

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

Comment By: Emmanuel BUU (neutrino38)
Date: 2010-09-11 01:14

Message:
Stack

gdb) where
#0  0x00007fdee6459247 in sched_yield () from /lib64/libc.so.6
#1  0x00007fdee0a64234 in get_lock (lock=0x7fdedd7a9a50) at
../../mem/../fastlock.h:182
#2  0x00007fdee0a6451a in send_publish (publ=0x7fffeed2c380) at
send_publish.c:438
#3  0x00007fdee04f7e71 in ul_publish (c=0x7fdedd814e20, type=1, param=0x0)
at ul_publish.c:262
#4  0x00007fdee33a452f in run_ul_callbacks (type=1, c=0x7fdedd814e20) at
ul_callback.h:88
#5  0x00007fdee33a4d4f in insert_ucontact (_r=0x7fdedd814db8,
_contact=0x7ae5d0, _ci=0x7fdee3190ba0, _c=0x7fffeed2c698)
    at urecord.c:430
#6  0x00007fdee2f8b222 in insert_contacts (_m=0x7ad308, _c=0x7ae5c0,
_d=0x7fdedd7ff908, _a=0x7fffeed2c7a0) at save.c:406
#7  0x00007fdee2f89e4e in add_contacts (_m=0x7ad308, _c=0x7ae5c0,
_d=0x7fdedd7ff908, _a=0x7fffeed2c7a0) at save.c:671
#8  0x00007fdee2f89953 in save (_m=0x7ad308, _d=0x7fdedd7ff908
"??\177??\177", _cflags=0x0, _s=0x0) at save.c:735
#9  0x000000000040d8fe in do_action ()
#10 0x000000000040c9c5 in run_action_list ()
#11 0x000000000046cd14 in eval_elem ()
#12 0x000000000046e475 in eval_expr ()
#13 0x000000000046e424 in eval_expr ()
#14 0x000000000046e44d in eval_expr ()
#15 0x000000000040da80 in do_action ()
#16 0x000000000040c9c5 in run_action_list ()
#17 0x000000000040f695 in do_action ()
#18 0x000000000040c9c5 in run_action_list ()
#19 0x000000000040f016 in do_action ()
#20 0x000000000040c9c5 in run_action_list ()
#21 0x000000000040f48c in do_action ()
#22 0x000000000040c9c5 in run_action_list ()
#23 0x000000000040f695 in do_action ()
#24 0x000000000040c9c5 in run_action_list ()
#25 0x00000000004107ff in run_top_route ()
#26 0x000000000045c768 in receive_msg ()
#27 0x000000000049b0a6 in udp_rcv_loop ()
#28 0x0000000000427404 in main ()


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

Comment By: Emmanuel BUU (neutrino38)
Date: 2010-09-11 01:14

Message:
traces when it is hanging

Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]: DBG:auth:check_response:
authorization is OK
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]: DBG:auth:post_auth:
nonce index= 1
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]:
DBG:auth_db:generate_avps: set string AVP "password"/0 = "xxxxx"
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]:
DBG:auth_db:generate_avps: set string AVP "username"/0 = "2005"
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]:
DBG:auth_db:generate_avps: set int AVP ""/1 = 50393
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]:
DBG:core:db_free_columns: freeing result columns at 0x7ae540
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]: DBG:core:db_free_rows:
freeing 1 rows
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]: DBG:core:db_free_row:
freeing row values at 0x7ae5d0
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]: DBG:core:db_free_rows:
freeing rows at 0x7ae5c0
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]: DBG:core:db_free_result:
freeing result set at 0x7ae500Sep 11 00:54:20 astdev2
/usr/sbin/opensips[5468]: DBG:core:db_free_result: SYNC-DBG - freeing
result!
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]: DBG:core:comp_scriptvar:
int 20 : 1 / -1
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]: DBG:core:comp_scriptvar:
int 20 : 1 / -5Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]:
DBG:core:comp_scriptvar: int 26 : 1 / 0Sep 11 00:54:20 astdev2
/usr/sbin/opensips[5468]: DBG:uri_db:check_username: Digest username and
URI username matchSep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]:
DBG:pua_usrloc:pua_set_publish: set send publish
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]: DBG:core:parse_headers:
flags=ffffffffffffffff
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]: DBG:core:parse_headers:
flags=8000000
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]: DBG:core:parse_headers:
flags=ffffffffffffffff
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]: DBG:core:parse_methods:
methods 0x173F
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]:
DBG:usrloc:run_ul_callbacks: contact=0x7fdedd814e20, callback type 1/1, i
d 0 entered
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]:
DBG:pua_usrloc:ul_publish: #012ul_publish: INSERT type
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]:
DBG:pua_usrloc:build_pidf: new_body:#012<?xml version="1.0"?>#012<presence
xmlns="urn:ietf:params:xml:ns:pidf"
xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"
xmlns:rpid="urn:ietf:params:xml:ns:
pidf:rpid" xmlns:c="urn:ietf:params:xml:ns:pidf:cipid"
entity="2005 at visioassistance.net">#012  <tuple>#012    <status>#012 
     <basic>open</basic>#012    </status>#012 
</tuple>#012</presence>#012
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]:
DBG:pua_usrloc:ul_publish: uri= sip:2005 at visioassistance.net
Sep 11 00:54:20 astdev2 /usr/sbin/opensips[5468]: DBG:pua:send_publish:
pres_uri=sip:2005 at visioassistance.net


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

Comment By: Emmanuel BUU (neutrino38)
Date: 2010-09-11 01:11

Message:
Script executed 


                pua_set_publish();


                if (!save("os_location"))
                {
                        xlog(" ERREUR save os_location\n");
                        sl_send_reply("500", "Registrar error");
                }


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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3063966&group_id=232389



More information about the Devel mailing list