[asterisk-commits] mjordan: branch mjordan/trunk-deadlock r376128 - /team/mjordan/trunk-deadlock...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 9 23:36:15 CST 2012


Author: mjordan
Date: Fri Nov  9 23:36:11 2012
New Revision: 376128

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376128
Log:
See if a thread is getting spawned before daemon.  I'm looking at you logger.

Modified:
    team/mjordan/trunk-deadlock/main/asterisk.c
    team/mjordan/trunk-deadlock/main/lock.c

Modified: team/mjordan/trunk-deadlock/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-deadlock/main/asterisk.c?view=diff&rev=376128&r1=376127&r2=376128
==============================================================================
--- team/mjordan/trunk-deadlock/main/asterisk.c (original)
+++ team/mjordan/trunk-deadlock/main/asterisk.c Fri Nov  9 23:36:11 2012
@@ -499,7 +499,12 @@
 void ast_register_thread(char *name)
 {
 	struct thread_list_t *new = ast_calloc(1, sizeof(*new));
-
+	static int first_time = 0;
+
+	if (!first_time) {
+		fprintf(stderr, "First registered thread %lx\n", (unsigned long int)pthread_self());
+		first_time = 1;
+	}
 	if (!new)
 		return;
 	new->id = pthread_self();
@@ -3975,6 +3980,7 @@
 		if (daemon(1, 0) < 0) {
 			ast_log(LOG_ERROR, "daemon() failed: %s\n", strerror(errno));
 		}
+		fprintf(stderr, "daemon finished\n");
 		ast_mainpid = getpid();
 		/* Blindly re-write pid file since we are forking */
 		unlink(ast_config_AST_PID);

Modified: team/mjordan/trunk-deadlock/main/lock.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-deadlock/main/lock.c?view=diff&rev=376128&r1=376127&r2=376128
==============================================================================
--- team/mjordan/trunk-deadlock/main/lock.c (original)
+++ team/mjordan/trunk-deadlock/main/lock.c Fri Nov  9 23:36:11 2012
@@ -1005,17 +1005,15 @@
 			__dump_backtrace(&lt->backtrace[lt->reentrancy], 0);
 			abort();
 		}
-		if (lt->reentrancy != AST_MAX_REENTRANCY) {
-			ast_bt_get_addresses(&lt->backtrace[lt->reentrancy]);
-			bt = &lt->backtrace[lt->reentrancy];
-			lt->file[lt->reentrancy] = filename;
-			lt->lineno[lt->reentrancy] = line;
-			lt->func[lt->reentrancy] = func;
-			lt->thread[lt->reentrancy] = pthread_self();
-		}
+		ast_bt_get_addresses(&lt->backtrace[0]);
+		bt = &lt->backtrace[0];
+		lt->file[0] = filename;
+		lt->lineno[0] = line;
+		lt->func[0] = func;
+		lt->thread[0] = pthread_self();
 		if (ast_reentrancy_unlock(lt)) {
-			fprintf(stderr, "Original thread ID %ld\n", lt->thread[lt->reentrancy]);
-			fprintf(stderr, "Current thread ID %ld\n", pthread_self());
+			fprintf(stderr, "Original thread ID %ulx\n", lt->thread[0]);
+			fprintf(stderr, "Current thread ID %ulx\n", pthread_self());
 			__dump_backtrace(&lt->backtrace[lt->reentrancy], 0);
 			abort();
 		}




More information about the asterisk-commits mailing list