[asterisk-commits] mjordan: branch mjordan/1.8_instrumented r363427 - /team/mjordan/1.8_instrume...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Apr 24 20:13:44 CDT 2012
Author: mjordan
Date: Tue Apr 24 20:13:39 2012
New Revision: 363427
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=363427
Log:
More fun debugging stuff
Moved the creation of the lock tracking stuff in utils.c
above the call to ast_register_thread, just in case that
really is the culprit
Modified:
team/mjordan/1.8_instrumented/main/lock.c
team/mjordan/1.8_instrumented/main/utils.c
Modified: team/mjordan/1.8_instrumented/main/lock.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/1.8_instrumented/main/lock.c?view=diff&rev=363427&r1=363426&r2=363427
==============================================================================
--- team/mjordan/1.8_instrumented/main/lock.c (original)
+++ team/mjordan/1.8_instrumented/main/lock.c Tue Apr 24 20:13:39 2012
@@ -809,6 +809,9 @@
#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
if (t->tracking && !t->track) {
+ if (!strcmp(filename, "asterisk.c") && !strcmp(func, "ast_register_thread")) {
+ __ast_mutex_logger("Should only see this once - initializing the reentrancy lock\n");
+ }
ast_reentrancy_init(&t->track);
}
lt = t->track;
@@ -850,11 +853,10 @@
filename, line, func, name);
lt->reentrancy = 0;
}
+ ast_reentrancy_unlock(lt);
if (!strcmp(filename, "asterisk.c") && !strcmp(func, "ast_register_thread")) {
__ast_mutex_logger("Global lock released by %s line %d (%s)\n", filename, line, func);
}
- ast_reentrancy_unlock(lt);
-
#ifdef HAVE_BKTR
ast_remove_lock_info(t, bt);
#else
@@ -872,8 +874,10 @@
__ast_mutex_logger("Crashing thread %s line %d (%s)\n", filename, line, func);
DO_THREAD_CRASH;
}
-#endif /* DEBUG_THREADS */
-
+ if (!strcmp(filename, "asterisk.c") && !strcmp(func, "ast_register_thread")) {
+ __ast_mutex_logger("Exiting unlock\n");
+ }
+#endif /* DEBUG_THREADS */
return res;
}
@@ -1051,6 +1055,9 @@
#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
if (t->tracking && !t->track) {
+ if (!strcmp(filename, "asterisk.c") && !strcmp(func, "ast_register_thread")) {
+ __ast_mutex_logger("Should only see this once - initializing the reentrancy lock\n");
+ }
ast_reentrancy_init(&t->track);
}
lt = t->track;
@@ -1132,10 +1139,10 @@
lt->thread[lt->reentrancy] = pthread_self();
lt->reentrancy++;
}
+ ast_reentrancy_unlock(lt);
if (!strcmp(filename, "asterisk.c") && !strcmp(func, "ast_register_thread")) {
__ast_mutex_logger("Global lock released by %s line %d (%s)\n", filename, line, func);
}
- ast_reentrancy_unlock(lt);
if (t->tracking) {
ast_mark_lock_acquired(t);
}
@@ -1147,10 +1154,10 @@
__ast_mutex_logger("Global lock %p obtained by %s line %d (%s) at %d\n", lt, filename, line, func, __LINE__);
}
bt = <->backtrace[lt->reentrancy-1];
+ ast_reentrancy_unlock(lt);
if (!strcmp(filename, "asterisk.c") && !strcmp(func, "ast_register_thread")) {
__ast_mutex_logger("Global lock released by %s line %d (%s)\n", filename, line, func);
}
- ast_reentrancy_unlock(lt);
} else {
bt = NULL;
}
@@ -1169,8 +1176,10 @@
__ast_mutex_logger("Crashing thread %s line %d (%s)\n", filename, line, func);
DO_THREAD_CRASH;
}
-#endif /* DEBUG_THREADS */
-
+ if (!strcmp(filename, "asterisk.c") && !strcmp(func, "ast_register_thread")) {
+ __ast_mutex_logger("Exiting wrlock\n");
+ }
+#endif /* DEBUG_THREADS */
return res;
}
Modified: team/mjordan/1.8_instrumented/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/1.8_instrumented/main/utils.c?view=diff&rev=363427&r1=363426&r2=363427
==============================================================================
--- team/mjordan/1.8_instrumented/main/utils.c (original)
+++ team/mjordan/1.8_instrumented/main/utils.c Tue Apr 24 20:13:39 2012
@@ -975,6 +975,23 @@
pthread_mutexattr_t mutex_attr;
#endif
+#ifdef DEBUG_THREADS
+ if (!(lock_info = ast_threadstorage_get(&thread_lock_info, sizeof(*lock_info))))
+ return NULL;
+
+ lock_info->thread_id = pthread_self();
+ lock_info->thread_name = strdup(a.name);
+
+ pthread_mutexattr_init(&mutex_attr);
+ pthread_mutexattr_settype(&mutex_attr, AST_MUTEX_KIND);
+ pthread_mutex_init(&lock_info->lock, &mutex_attr);
+ pthread_mutexattr_destroy(&mutex_attr);
+
+ pthread_mutex_lock(&lock_infos_lock.mutex); /* Intentionally not the wrapper */
+ AST_LIST_INSERT_TAIL(&lock_infos, lock_info, entry);
+ pthread_mutex_unlock(&lock_infos_lock.mutex); /* Intentionally not the wrapper */
+#endif /* DEBUG_THREADS */
+
/* note that even though data->name is a pointer to allocated memory,
we are not freeing it here because ast_register_thread is going to
keep a copy of the pointer and then ast_unregister_thread will
@@ -983,23 +1000,6 @@
ast_free(data);
ast_register_thread(a.name);
pthread_cleanup_push(ast_unregister_thread, (void *) pthread_self());
-
-#ifdef DEBUG_THREADS
- if (!(lock_info = ast_threadstorage_get(&thread_lock_info, sizeof(*lock_info))))
- return NULL;
-
- lock_info->thread_id = pthread_self();
- lock_info->thread_name = strdup(a.name);
-
- pthread_mutexattr_init(&mutex_attr);
- pthread_mutexattr_settype(&mutex_attr, AST_MUTEX_KIND);
- pthread_mutex_init(&lock_info->lock, &mutex_attr);
- pthread_mutexattr_destroy(&mutex_attr);
-
- pthread_mutex_lock(&lock_infos_lock.mutex); /* Intentionally not the wrapper */
- AST_LIST_INSERT_TAIL(&lock_infos, lock_info, entry);
- pthread_mutex_unlock(&lock_infos_lock.mutex); /* Intentionally not the wrapper */
-#endif /* DEBUG_THREADS */
ret = a.start_routine(a.data);
More information about the asterisk-commits
mailing list