]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Move AMI initialization to occur after loading modules. This prevents a
authorRussell Bryant <russell@russellbryant.com>
Sat, 25 Oct 2008 10:59:02 +0000 (10:59 +0000)
committerRussell Bryant <russell@russellbryant.com>
Sat, 25 Oct 2008 10:59:02 +0000 (10:59 +0000)
deadlock when someone tries to initiate a module reload from the AMI just
as Asterisk is starting.

(closes issue #13778)
Reported by: hotsblanc
Fix suggested by hotsblanc

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@151905 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/asterisk.c

index cee50d6770a30443f396b025259b50c8f2aa7802..0a978a949ea7e522dcad91a0503bacc18402d1f6 100644 (file)
@@ -3061,11 +3061,6 @@ int main(int argc, char *argv[])
 
        ast_channels_init();
 
-       if (init_manager()) {
-               printf(term_quit());
-               exit(1);
-       }
-
        if (ast_cdr_engine_init()) {
                printf(term_quit());
                exit(1);
@@ -3115,6 +3110,15 @@ int main(int argc, char *argv[])
                exit(1);
        }
 
+       /* AMI is initialized after loading modules because of a potential
+        * conflict between issuing a module reload from manager and
+        * registering manager actions.  This will cause reversed locking
+        * order between the module list and manager actions list. */
+       if (init_manager()) {
+               printf(term_quit());
+               exit(1);
+       }
+
        dnsmgr_start_refresh();
 
        /* We might have the option of showing a console, but for now just