[asterisk-commits] mjordan: branch mjordan/trunk-deadlock r376125 - in /team/mjordan/trunk-deadl...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Nov 9 19:55:26 CST 2012
Author: mjordan
Date: Fri Nov 9 19:55:21 2012
New Revision: 376125
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376125
Log:
Dump the lock info when an unlock failure occurs
The question is: why is there an unlock failure when the logger
thread registers itself?
Modified:
team/mjordan/trunk-deadlock/include/asterisk/lock.h
team/mjordan/trunk-deadlock/main/lock.c
Modified: team/mjordan/trunk-deadlock/include/asterisk/lock.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-deadlock/include/asterisk/lock.h?view=diff&rev=376125&r1=376124&r2=376125
==============================================================================
--- team/mjordan/trunk-deadlock/include/asterisk/lock.h (original)
+++ team/mjordan/trunk-deadlock/include/asterisk/lock.h Fri Nov 9 19:55:21 2012
@@ -428,26 +428,24 @@
} \
} while (0)
-static inline void ast_reentrancy_lock(struct ast_lock_track *lt)
+static inline int ast_reentrancy_lock(struct ast_lock_track *lt)
{
int res;
res = pthread_mutex_lock(<->reentr_mutex);
if (res) {
fprintf(stderr, "Failed to lock reentrancy mutex: %s[%d]\n", strerror(res), res);
- usleep(1);
- abort();
}
+ return res;
}
-static inline void ast_reentrancy_unlock(struct ast_lock_track *lt)
+static inline int ast_reentrancy_unlock(struct ast_lock_track *lt)
{
int res;
res = pthread_mutex_unlock(<->reentr_mutex);
if (res) {
fprintf(stderr, "Failed to unlock reentrancy mutex: %s[%d]\n", strerror(res), res);
- usleep(1);
- abort();
}
+ return res;
}
static inline void ast_reentrancy_init(struct ast_lock_track **plt)
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=376125&r1=376124&r2=376125
==============================================================================
--- team/mjordan/trunk-deadlock/main/lock.c (original)
+++ team/mjordan/trunk-deadlock/main/lock.c Fri Nov 9 19:55:21 2012
@@ -1001,12 +1001,18 @@
if (t->tracking) {
#ifdef HAVE_BKTR
- ast_reentrancy_lock(lt);
+ if (ast_reentrancy_lock(lt)) {
+ __dump_backtrace(<->backtrace[lt->reentrancy], 0);
+ abort();
+ }
if (lt->reentrancy != AST_MAX_REENTRANCY) {
ast_bt_get_addresses(<->backtrace[lt->reentrancy]);
bt = <->backtrace[lt->reentrancy];
}
- ast_reentrancy_unlock(lt);
+ if (ast_reentrancy_unlock(lt)) {
+ __dump_backtrace(<->backtrace[lt->reentrancy], 0);
+ abort();
+ }
ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt);
#else
ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t);
More information about the asterisk-commits
mailing list