[Home]

Summary:ASTERISK-05422: Deadlock debugging code broken
Reporter:Wojtek Kaniewski (wojtekka)Labels:
Date Opened:2005-11-02 05:31:26.000-0600Date Closed:2008-01-15 15:54:50.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:When compiling Asterisk with DETECT_DEADLOCKS option, I get bunch of warnings like:

include/asterisk/lock.h: In function `__ast_pthread_mutex_lock':
include/asterisk/lock.h:238: warning: char format, pointer arg (arg 6)
include/asterisk/lock.h:238: warning: int format, pointer arg (arg 7)
include/asterisk/lock.h:238: warning: char format, pointer arg (arg 8)
include/asterisk/lock.h:238: warning: char format, pointer arg (arg 3)
include/asterisk/lock.h:238: warning: int format, pointer arg (arg 4)
include/asterisk/lock.h:238: warning: char format, pointer arg (arg 5)

****** ADDITIONAL INFORMATION ******

They don't occur when Asterisk is compiled without DETECT_DEADLOCKS. After a quick look at the code I found that deadlock detection code went unnotices after some changes in lock.h. ast_mutex_t fields were changed to arrays, but __ast_pthread_mutex_lock still tries to access them as plain variables. The offending line should probably be changed from:

  __ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n", t->file, t->lineno, t->func, mutex_name);

to something like:

  __ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n", t->file[t->reentrancy-1], t->lineno[t->reentrancy-1], t->func[t->reentrancy-1], mutex_name);

Asterisk compiles fine then, but I have no idea what values reentrancy fields takes, so there's possibility that such fix would make Asterisk segfault on a first deadlock.

The compiler is a PPC 4xx gcc version 3.2.2 20030217 (Yellow Dog Linux 3.0 3.2.2-2a_1).
Comments:By: Kevin P. Fleming (kpfleming) 2005-11-07 23:03:20.000-0600

Yes, that was the correct fix. Fixed in CVS HEAD, thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:54:50.000-0600

Repository: asterisk
Revision: 7022

U   trunk/ChangeLog
U   trunk/include/asterisk/lock.h

------------------------------------------------------------------------
r7022 | kpfleming | 2008-01-15 15:54:50 -0600 (Tue, 15 Jan 2008) | 2 lines

issue ASTERISK-5422

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=7022