]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Allow AMI action callback to be reentrant.
authorRichard Mudgett <rmudgett@digium.com>
Tue, 20 Mar 2012 17:25:44 +0000 (17:25 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Tue, 20 Mar 2012 17:25:44 +0000 (17:25 +0000)
commit01b999f833311064e69d32a03caf35b8f7130e79
treebe119f681540ce37e60eba962307c7992f5d6ebf
parentba1a6fc5f7ba1f8d9010085b2d05e2a358fa2768
Allow AMI action callback to be reentrant.

Fix AMI module reload deadlock regression from ASTERISK-18479 when it
tried to fix the race between calling an AMI action callback and
unregistering that action.  Refixes ASTERISK-13784 broken by
ASTERISK-17785 change.

Locking the ao2 object guaranteed that there were no active callbacks that
mattered when ast_manager_unregister() was called.  Unfortunately, this
causes the deadlock situation.  The patch stops locking the ao2 object to
allow multiple threads to invoke the callback re-entrantly.  There is no
way to guarantee a module unload will not crash because of an active
callback.  The code attempts to minimize the chance with the registered
flag and the maximum 5 second delay before ast_manager_unregister()
returns.

The trunk version of the patch changes the API to fix the race condition
correctly to prevent the module code from unloading from memory while an
action callback is active.

* Don't hold the lock while calling the AMI action callback.

(closes issue ASTERISK-19487)
Reported by: Philippe Lindheimer

Review: https://reviewboard.asterisk.org/r/1818/
Review: https://reviewboard.asterisk.org/r/1820/
........

Merged revisions 359979 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@359980 65c4cc65-6c06-0410-ace0-fbb531ad65f3
include/asterisk/manager.h
main/manager.c