This message was generated by the Security Alerts service ( Free Trial 14th of 
August - 14th of September )
http://www.opensips.org/Resources/AlertsMain
*
SVN commit*:
http://opensips.svn.sourceforge.net/opensips/?rev=9177&view=rev

*Severity*: Medium

*Version*  : all

*Affected modules*  : Load-Balancer module

*Effect*  : Loosing load on destination after a restart

*Affected scenarios*: If loading (as module) the Dialog module before the 
Load-Balancer module, during an OpenSIPS restart,
the active load (number of ongoing calls) on the LB destinations will not be 
restored, but simply set to 0 for all
destinations and resources. This will break the load balancing alg, as OpenSIPS LB will 
do not "know" the calls established
prior to restart.
Nevertheless, the system will recover in time and start behaving normally once 
the inherited calls (established before the
restart) are terminated.

*Description:*  The actual problem resides in the dialog module which was not 
able to properly restore the profile information
for the call loaded from DB at startup time. The interaction between the Dialog 
and LB module is a bit particular, as the
LB module creates (as init time) dynamic dialog profiles (according to 
destinations and resources). So, if the Dialog module
is loaded first, it will not know the dialog profiles required by LB, so it 
will not be able to restore the dialog context.

*Risks*  : have more load on destinations than configured (as upper limit), but 
limited to a restart event

*Update*  :
- if you have an SVN checkout, 1.7, 1.8 and trunk were fixed; so update to a 
revision later than 9177 (trunk),
  9178 (1.8 branch) or 9179 (1.7 branch).
- if you have OpenSIPS from sources see the attached patch;
- if using tarballs, they were already regenerated (and include the fix). 
Available only for 1.8.
- If using the official Debian package (apt.opensips.org), they are also 
re-generated including the fix
  (available for 1.8 and trunk).


--
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

Index: modules/dialog/dlg_db_handler.c
===================================================================
--- modules/dialog/dlg_db_handler.c	(revision 9177)
+++ modules/dialog/dlg_db_handler.c	(revision 9178)
@@ -376,6 +376,7 @@
 	str name, val;
 	char *end;
 	char *p;
+	char bk;
 
 	end = b + l;
 	p = b;
@@ -401,8 +402,22 @@
 		/* add to the profile */
 		profile = search_dlg_profile( &name );
 		if (profile==NULL) {
-			LM_ERR("profile <%.*s> does not exist anymore\n",name.len,name.s);
-			continue;
+			LM_DBG("profile <%.*s> does not exist now, creating it\n",name.len,name.s);
+			/* create a new one */
+			bk = name.s[name.len];
+			name.s[name.len] = 0;
+			if (add_profile_definitions(name.s, (val.len && val.s)?1:0 ) != 0) {
+				LM_ERR("failed to add dialog profile <%.*s>\n", name.len, name.s);
+				name.s[name.len] = bk;
+				continue;
+			}
+			name.s[name.len] = bk;
+			/* double check the created profile */
+			profile = search_dlg_profile(&name);
+			if (profile == NULL) {
+				LM_CRIT("BUG - cannot find just added dialog profile <%.*s>\n", name.len, name.s);
+				continue;
+			}
 		}
 		if (set_dlg_profile( NULL, profile->has_value?&val:NULL, profile) < 0 )
 			LM_ERR("failed to add to profile, skipping....\n");
_______________________________________________
Alerts mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/alerts
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to