[Home]

Summary:ASTERISK-11521: Deadlock if feature in use while reload attempted
Reporter:Chase Venters (chaseventers)Labels:
Date Opened:2008-02-26 19:29:45.000-0600Date Closed:2008-02-27 11:08:33.000-0600
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Resources/res_features
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) reload-deadlock.txt
Description:We encountered a deadlock today with Asterisk 1.4.18. I gave Asterisk SIGSEGV so that I could get a crash dump to see what is going on. (We don't build with DEBUG_THREADS right now because we had a crash bug in that code some months prior).

The deadlock appears to be this: in thread 10327, ast_module_reload() grabs the module_list lock and then nests into the reload() callback for a module. The res_features.c reload() function calls load_config(), which calls unmap_features() which attempts to acquire features_lock.

Meanwhile, another thread (10314 in my dump) has features_lock read-locked inside of ast_feature_interpret(). That calls builtin_blindtransfer() through the .operation function pointer, which is calling finishup, and eventually finds its way to ast_update_use_count(), which wants the module_list lock.

So the "reload" thread 10327 has module_list and wants features_lock. 10314 has features_lock but wants module_list. A deadlock results.
Comments:By: Digium Subversion (svnbot) 2008-02-27 11:03:56.000-0600

Repository: asterisk
Revision: 104596

U   branches/1.4/main/loader.c

------------------------------------------------------------------------
r104596 | file | 2008-02-27 11:03:55 -0600 (Wed, 27 Feb 2008) | 4 lines

Use the lock (which already existed, it just wasn't used) on the updaters list to protect the contents instead of the overall module list lock.
(closes issue ASTERISK-11521)
Reported by: ChaseVenters

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

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

By: Digium Subversion (svnbot) 2008-02-27 11:08:33.000-0600

Repository: asterisk
Revision: 104597

_U  trunk/
U   trunk/main/loader.c

------------------------------------------------------------------------
r104597 | file | 2008-02-27 11:08:31 -0600 (Wed, 27 Feb 2008) | 12 lines

Merged revisions 104596 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r104596 | file | 2008-02-27 13:07:33 -0400 (Wed, 27 Feb 2008) | 4 lines

Use the lock (which already existed, it just wasn't used) on the updaters list to protect the contents instead of the overall module list lock.
(closes issue ASTERISK-11521)
Reported by: ChaseVenters

........

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

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