[sr-dev] git:5.1:2c91b11a: pua_reginfo: fix crash and issue during high load

Daniel-Constantin Mierla miconda at gmail.com
Wed Aug 22 11:01:51 CEST 2018


Module: kamailio
Branch: 5.1
Commit: 2c91b11abbe835ca3319ba3517d9fd726f078937
URL: https://github.com/kamailio/kamailio/commit/2c91b11abbe835ca3319ba3517d9fd726f078937

Author: lasseo <lars.olsson76 at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-08-22T11:01:14+02:00

pua_reginfo: fix crash and issue during high load

- do not release a already deleted entry, as this causes a crash

- use sruid_next_safe instead of sruid_next as it has been seen during load that same sruid returned on multiple threads

(cherry picked from commit 62e0af0957a6c7e3c2ea9711cf64ad51f4b2e594)

---

Modified: src/modules/pua_reginfo/notify.c

---

Diff:  https://github.com/kamailio/kamailio/commit/2c91b11abbe835ca3319ba3517d9fd726f078937.diff
Patch: https://github.com/kamailio/kamailio/commit/2c91b11abbe835ca3319ba3517d9fd726f078937.patch

---

diff --git a/src/modules/pua_reginfo/notify.c b/src/modules/pua_reginfo/notify.c
index 754a2ed099..ea50f2db65 100644
--- a/src/modules/pua_reginfo/notify.c
+++ b/src/modules/pua_reginfo/notify.c
@@ -111,7 +111,7 @@ int process_contact(udomain_t * domain, urecord_t ** ul_record, str aor, str cal
 	ci.expires = time(0) + expires;
 
 	/* set ruid */
-	if(sruid_next(&_reginfo_sruid) < 0) {
+	if(sruid_next_safe(&_reginfo_sruid) < 0) {
 		LM_ERR("failed to generate ruid");
 	} else {
 		ci.ruid = _reginfo_sruid.uid;
@@ -306,9 +306,15 @@ int process_body(str notify_body, udomain_t * domain) {
 					}
 					ul_contact = ul_contact->next;
 				}
+				
 				if (ul.delete_urecord(domain, &aor_key, ul_record) < 0) {
 					LM_ERR("failed to remove record from usrloc\n");
-				}
+				} 
+
+				/* Record deleted, and should not be used anymore */
+				ul_record = NULL;
+				
+				
 				/* If already a registration with contacts was found, then keep that result.
 				   otherwise the result is now "No contacts found" */
 				if (final_result != RESULT_CONTACTS_FOUND) final_result = RESULT_NO_CONTACTS;




More information about the sr-dev mailing list