Hi guys,

While doing some load tests with the latest committed binrpc plug-in, I've been receiving errors about replies that didn't match any pending transaction. I've pimped a bit the logging (see ticket #SEMS-40, as well as the attached diff).

I first thought that the transaction is added too late to the transaction map (uac_trans) -- after sending out the message --, so, I've reversed operation order (see core/AmSipDialog.cpp patch within diff). Things did not improve, so I added a bit more of logging (see core/AmEventDispatcher.cpp patch) and found out that the whole session is enqueued too late: due to scheduling (at least on higher load) it can always happen (no matter the used "control" plug-in) that a reply for an originated request arrives faster than the running thread manages to enqueue the just created session.


Regards,

--
Bogdan Pintea

iptego GmbH
http://www.iptego.com

Index: core/AmSipDialog.cpp
===================================================================
--- core/AmSipDialog.cpp        (revision 1075)
+++ core/AmSipDialog.cpp        (working copy)
@@ -599,14 +599,21 @@
     req.body = body;
   }
 
-  if (AmServer::sendRequest(req, serKey, serKeyLen))
-    return -1;
-    
   uac_trans[cseq] = AmSipTransaction(method,cseq);
+  DBG("started SIP trans: meth:%s;cseq:%d;l-tag:%s;r-tag:%s.", method.c_str(),
+      cseq, local_tag.c_str(), remote_tag.c_str());
 
   // increment for next request
   cseq++;
-    
+
+  if (AmServer::sendRequest(req, serKey, serKeyLen)) {
+    uac_trans.erase(cseq - 1);
+    ERROR("failed to send request (l-tag:%s).\n", local_tag.c_str());
+    return -1;
+  } else {
+    DBG("successfully sent request (l-tag:%s).\n", local_tag.c_str());
+  }
+
   return 0;
 }
 
Index: core/AmEventDispatcher.cpp
===================================================================
--- core/AmEventDispatcher.cpp  (revision 1075)
+++ core/AmEventDispatcher.cpp  (working copy)
@@ -53,6 +53,7 @@
 
     if(!exists){
        queues[local_tag] = q;
+       DBG("l-tag '%s' enqueued.\n", local_tag.c_str());
 
        if(!callid.empty() && !remote_tag.empty())
            id_lookup[callid+remote_tag] = local_tag;
@@ -76,6 +77,7 @@
 
        q = qi->second;
        queues.erase(qi);
+       DBG("l-tag '%s' dequeued.\n", local_tag.c_str());
 
        if(!callid.empty() && !remote_tag.empty()) {
 
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to