Re: [Bayonne-dialogic] bayonne locks a line in state "step"

"infos chez fdrconseil" <[email protected]>
Newsgroups gmane.comp.gnu.bayonne.devel
Organization FdR Conseil
Message-ID <[email protected]>
Hello,

We went on using our stress script and we found a mutex dead-lock in  
certain conditions
when starting new scripts with the command start.group.
When a line is not idle and when the start command tries to post the  
TRUNK_START_SCRIPT event, the postEvent
function (in Dialogic and Globalcall drivers at least) stays blocked by  
entering a mutex already  positionned
by the current task.
Moreover, after having corrected this, we noticed that when the start  
command does not find any free line, it
stucks without raising the error it should.

So we modified the files : trunk.cpp for Dialogic and Globacall, and  
script.cpp in the server directory :
	- trunk.cpp to check if the trunk is in the "idle" state
	- script.cpp to raise an error if no trunk is available for starting a  
script

We keep having a potential problem. Since the mutexes used by Bayonne are  
read/write we cannot enter the mutex to
test the state of the trunk (comparing the value of "handler" to the  
pointer "DialogicTrunk::idleHandler")
because if so, we would fall again in the deadlock. Then reading this  
attribute (handler) we may conflict
with an other thread if this one was modifying the attribute at the same  
time.

However, stressing bayonne with the stress script did not show any  
conflict, so we publish the patch.

Patch against the version 1.2.14 is following and is attached :

Comments are welcome,

FdR (*#)


diff -Naur bayonne-1.2.14/drivers/dialogic/trunk.cpp  
bayonne-1.2.14.after/drivers/dialogic/trunk.cpp
--- bayonne-1.2.14/drivers/dialogic/trunk.cpp	2004-10-27  
12:04:58.000000000 +0200
+++ bayonne-1.2.14.after/drivers/dialogic/trunk.cpp	2005-02-26  
16:51:32.000000000 +0100
@@ -579,6 +579,11 @@
  	bool rtn = true;
  	trunkhandler_t prior;

+	if (event->id == TRUNK_START_SCRIPT) {
+		if (handler != &DialogicTrunk::idleHandler) {
+			return false;
+		}
+	}
  	enterMutex();
  	switch(event->id)
  	{
diff -Naur bayonne-1.2.14/drivers/globalcall/trunk.cpp  
bayonne-1.2.14.after/drivers/globalcall/trunk.cpp
--- bayonne-1.2.14/drivers/globalcall/trunk.cpp	2005-01-26  
11:43:29.000000000 +0100
+++ bayonne-1.2.14.after/drivers/globalcall/trunk.cpp	2005-02-26  
16:50:55.000000000 +0100
@@ -500,6 +500,11 @@
  	bool rtn = true;
  	trunkhandler_t prior;

+	if (event->id == TRUNK_START_SCRIPT) {
+		if (handler != &DialogicTrunk::idleHandler) {
+			return false;
+		}
+	}
  	enterMutex();
  	switch(event->id)
  	{
diff -Naur bayonne-1.2.14/server/script.cpp  
bayonne-1.2.14.after/server/script.cpp
--- bayonne-1.2.14/server/script.cpp	2004-10-27 12:04:59.000000000 +0200
+++ bayonne-1.2.14.after/server/script.cpp	2005-02-26 16:49:05.000000000  
+0100
@@ -3352,7 +3352,10 @@

  	if(start)
  	{
-		fifo.command(args);
+		if (!fifo.command(args)) {
+			error("start-failed");
+			return true;
+		}
  		return rtn;
  	}

_______________________________________________
Bayonne-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bayonne-devel
bugStartScript.diff (application/octet-stream, 1.4 KB)
diff -Naur bayonne-1.2.14/drivers/dialogic/trunk.cpp bayonne-1.2.14.after/drivers/dialogic/trunk.cpp
--- bayonne-1.2.14/drivers/dialogic/trunk.cpp	2004-10-27 12:04:58.000000000 +0200
+++ bayonne-1.2.14.after/drivers/dialogic/trunk.cpp	2005-02-26 16:51:32.000000000 +0100
@@ -579,6 +579,11 @@
 	bool rtn = true;
 	trunkhandler_t prior;
 
+	if (event->id == TRUNK_START_SCRIPT) {
+		if (handler != &DialogicTrunk::idleHandler) {
+			return false;
+		}
+	}
 	enterMutex();
 	switch(event->id)
 	{
diff -Naur bayonne-1.2.14/drivers/globalcall/trunk.cpp bayonne-1.2.14.after/drivers/globalcall/trunk.cpp
--- bayonne-1.2.14/drivers/globalcall/trunk.cpp	2005-01-26 11:43:29.000000000 +0100
+++ bayonne-1.2.14.after/drivers/globalcall/trunk.cpp	2005-02-26 16:50:55.000000000 +0100
@@ -500,6 +500,11 @@
 	bool rtn = true;
 	trunkhandler_t prior;
 
+	if (event->id == TRUNK_START_SCRIPT) {
+		if (handler != &DialogicTrunk::idleHandler) {
+			return false;
+		}
+	}
 	enterMutex();
 	switch(event->id)
 	{
diff -Naur bayonne-1.2.14/server/script.cpp bayonne-1.2.14.after/server/script.cpp
--- bayonne-1.2.14/server/script.cpp	2004-10-27 12:04:59.000000000 +0200
+++ bayonne-1.2.14.after/server/script.cpp	2005-02-26 16:49:05.000000000 +0100
@@ -3352,7 +3352,10 @@
 
 	if(start)
 	{
-		fifo.command(args);
+		if (!fifo.command(args)) {
+			error("start-failed");
+			return true;
+		}
 		return rtn;
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.