PJSIP various fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

We are using PJSIP 2.1 on the Blackberry Z10 nowadays and we had to do
various fixes. Here's a list of patches, which I hope you will include
in the next
release:

mutex_zalloc.patch:
pj_mutex_create allocates memory from the pool and calls
pthread_mutex_init(). We had cases where it would return EBUSY error,
probably because the allocated memory was not zeroed and
pthread_mutex_init() was thinking it was initializing an existing mutex.

locks-cleanup.patch:
pjsip_tpmgr_create() creates a mutex and an atomic variable but does not
clean them up if an error later in the functions occurs.

deinit_sip_parser_call.patch:
If pjsip_endpt_create() failed for several times, we were hitting
asserts in pjsip_tel_uri_subsys_init() as it's buffer was full. To
prevent that, we had to call deinit_sip_parser() for graceful cleanup
when pjsip_endpt_create() fails.

Robbie Groenewoudt




-------------- next part --------------
# HG changeset patch
# User Robbie Groenewoudt <robbie at inmote.com>
# Date 1369648774 -7200
#      Mon May 27 11:59:34 2013 +0200
# Node ID b5892d1b070e9b7c11fca85c4c1421ad11da4235
# Parent  ad2bca953ba5cab62ab5404bafdc536d108c039b
Fix pjsip_tpmgr_create() not destroying locks on error.

diff -r ad2bca953ba5 -r b5892d1b070e pjproject-2.1.0/pjsip/src/pjsip/sip_transport.c
--- a/pjproject-2.1.0/pjsip/src/pjsip/sip_transport.c	Mon May 27 11:25:01 2013 +0200
+++ b/pjproject-2.1.0/pjsip/src/pjsip/sip_transport.c	Mon May 27 11:59:34 2013 +0200
@@ -1218,14 +1218,19 @@
 
 #if defined(PJ_DEBUG) && PJ_DEBUG!=0
     status = pj_atomic_create(pool, 0, &mgr->tdata_counter);
-    if (status != PJ_SUCCESS)
-	return status;
+    if (status != PJ_SUCCESS) {
+    	pj_lock_destroy(mgr->lock);
+    	return status;
+    }
 #endif
 
     /* Set transport state callback */
     status = pjsip_tpmgr_set_state_cb(mgr, &tp_state_callback);
-    if (status != PJ_SUCCESS)
-	return status;
+    if (status != PJ_SUCCESS) {
+    	pj_lock_destroy(mgr->lock);
+    	pj_atomic_destroy(mgr->tdata_counter);
+    	return status;
+    }
 
     PJ_LOG(5, (THIS_FILE, "Transport manager created."));
 

-------------- next part --------------
# HG changeset patch
# User Robbie Groenewoudt <robbie at inmote.com>
# Date 1369648899 -7200
#      Mon May 27 12:01:39 2013 +0200
# Node ID 205a4f1abfacbfef9f1110345397e392cf9e664d
# Parent  b5892d1b070e9b7c11fca85c4c1421ad11da4235
Use zeroed memory when creating pj_mutex_t to prevent EBUSY error from pthread_mutex_init.

diff -r b5892d1b070e -r 205a4f1abfac pjproject-2.1.0/pjlib/src/pj/os_core_unix.c
--- a/pjproject-2.1.0/pjlib/src/pj/os_core_unix.c	Mon May 27 11:59:34 2013 +0200
+++ b/pjproject-2.1.0/pjlib/src/pj/os_core_unix.c	Mon May 27 12:01:39 2013 +0200
@@ -1186,7 +1186,7 @@
 
     PJ_ASSERT_RETURN(pool && ptr_mutex, PJ_EINVAL);
 
-    mutex = PJ_POOL_ALLOC_T(pool, pj_mutex_t);
+    mutex = PJ_POOL_ZALLOC_T(pool, pj_mutex_t);
     PJ_ASSERT_RETURN(mutex, PJ_ENOMEM);
 
     if ((rc=init_mutex(mutex, name, type)) != PJ_SUCCESS)

-------------- next part --------------
# HG changeset patch
# User Robbie Groenewoudt <robbie at inmote.com>
# Date 1368803472 -7200
#      Fri May 17 17:11:12 2013 +0200
# Node ID a58e229d759d9ab8d058934080bc92ce932190e9
# Parent  85d391b6fbecd9676a7f36aee6187e2d94a0548e
Fix assert in pjsip_tel_uri_subsys_init if creating endpoint fails.

diff -r 85d391b6fbec -r a58e229d759d pjproject-2.1.0/pjsip/src/pjsip/sip_endpoint.c
--- a/pjproject-2.1.0/pjsip/src/pjsip/sip_endpoint.c	Fri May 17 15:34:24 2013 +0200
+++ b/pjproject-2.1.0/pjsip/src/pjsip/sip_endpoint.c	Fri May 17 17:11:12 2013 +0200
@@ -563,6 +563,10 @@
 	pj_mutex_destroy(endpt->mutex);
 	endpt->mutex = NULL;
     }
+
+    deinit_sip_parser();
+
     if (endpt->mod_mutex) {
 	pj_rwmutex_destroy(endpt->mod_mutex);
 	endpt->mod_mutex = NULL;



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux