<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/8498">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">core: Remove non-critical cleanup from startup aborts.<br><br>When built-in components of Asterisk fail to start they cause the<br>Asterisk startup to abort.  In these cases only the most critical<br>cleanup should be performed - closing databases and terminating<br>proceses.  These cleanups are registered using ast_register_atexit, all<br>other cleanups should not be run during startup abort.<br><br>The main reason for this change is that these cleanup procedures are<br>untestable from the partially initialized states, if they fail it could<br>prevent us from ever running the critical cleanup with ast_run_atexits.<br><br>Change-Id: Iecc2df98008b21509925ff16740bd5fa29527db3<br>---<br>M main/cel.c<br>M main/core_local.c<br>M main/devicestate.c<br>M main/dsp.c<br>M main/features.c<br>M main/features_config.c<br>M main/indications.c<br>M main/pbx_builtins.c<br>M main/sorcery.c<br>9 files changed, 13 insertions(+), 46 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/cel.c b/main/cel.c<br>index 31cd045..45726e0 100644<br>--- a/main/cel.c<br>+++ b/main/cel.c<br>@@ -1565,7 +1565,6 @@<br>  ao2_global_obj_replace_unref(cel_linkedids, container);<br>       ao2_cleanup(container);<br>       if (!container) {<br>-            cel_engine_cleanup();<br>                 return -1;<br>    }<br> <br>@@ -1574,17 +1573,14 @@<br>         ao2_global_obj_replace_unref(cel_dialstatus_store, container);<br>        ao2_cleanup(container);<br>       if (!container) {<br>-            cel_engine_cleanup();<br>                 return -1;<br>    }<br> <br>  if (STASIS_MESSAGE_TYPE_INIT(cel_generic_type)) {<br>-            cel_engine_cleanup();<br>                 return -1;<br>    }<br> <br>  if (ast_cli_register(&cli_status)) {<br>-             cel_engine_cleanup();<br>                 return -1;<br>    }<br> <br>@@ -1592,12 +1588,10 @@<br>         ao2_global_obj_replace_unref(cel_backends, container);<br>        ao2_cleanup(container);<br>       if (!container) {<br>-            cel_engine_cleanup();<br>                 return -1;<br>    }<br> <br>  if (aco_info_init(&cel_cfg_info)) {<br>-              cel_engine_cleanup();<br>                 return -1;<br>    }<br> <br>@@ -1610,7 +1604,6 @@<br>           struct cel_config *cel_cfg = cel_config_alloc();<br> <br>           if (!cel_cfg) {<br>-                      cel_engine_cleanup();<br>                         return -1;<br>            }<br> <br>@@ -1623,12 +1616,10 @@<br>         }<br> <br>  if (create_subscriptions()) {<br>-                cel_engine_cleanup();<br>                 return -1;<br>    }<br> <br>  if (ast_cel_check_enabled() && create_routes()) {<br>-            cel_engine_cleanup();<br>                 return -1;<br>    }<br> <br>diff --git a/main/core_local.c b/main/core_local.c<br>index a5918f5..12e41f9 100644<br>--- a/main/core_local.c<br>+++ b/main/core_local.c<br>@@ -1074,7 +1074,6 @@<br> <br> int ast_local_init(void)<br> {<br>-<br>         if (STASIS_MESSAGE_TYPE_INIT(ast_local_optimization_begin_type)) {<br>            return -1;<br>    }<br>@@ -1094,17 +1093,13 @@<br> <br>         locals = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, locals_cmp_cb);<br>  if (!locals) {<br>-               ao2_cleanup(local_tech.capabilities);<br>-                local_tech.capabilities = NULL;<br>               return -1;<br>    }<br> <br>  /* Make sure we can register our channel type */<br>      if (ast_channel_register(&local_tech)) {<br>          ast_log(LOG_ERROR, "Unable to register channel class 'Local'\n");<br>-          ao2_ref(locals, -1);<br>-         ao2_cleanup(local_tech.capabilities);<br>-                local_tech.capabilities = NULL;<br>+<br>            return -1;<br>    }<br>     ast_cli_register_multiple(cli_local, ARRAY_LEN(cli_local));<br>diff --git a/main/devicestate.c b/main/devicestate.c<br>index faba144..4bc0bed 100644<br>--- a/main/devicestate.c<br>+++ b/main/devicestate.c<br>@@ -913,24 +913,20 @@<br>   }<br>     device_state_topic_all = stasis_topic_create("ast_device_state_topic");<br>     if (!device_state_topic_all) {<br>-               devstate_cleanup();<br>           return -1;<br>    }<br>     device_state_topic_pool = stasis_topic_pool_create(ast_device_state_topic_all());<br>     if (!device_state_topic_pool) {<br>-              devstate_cleanup();<br>           return -1;<br>    }<br>     device_state_cache = stasis_cache_create_full(device_state_get_id,<br>            device_state_aggregate_calc, device_state_aggregate_publish);<br>         if (!device_state_cache) {<br>-           devstate_cleanup();<br>           return -1;<br>    }<br>     device_state_topic_cached = stasis_caching_topic_create(ast_device_state_topic_all(),<br>                 device_state_cache);<br>  if (!device_state_topic_cached) {<br>-            devstate_cleanup();<br>           return -1;<br>    }<br> <br>@@ -938,7 +934,6 @@<br>             devstate_change_cb, NULL);<br>    if (!devstate_message_sub) {<br>          ast_log(LOG_ERROR, "Failed to create subscription creating uncached device state aggregate events.\n");<br>-            devstate_cleanup();<br>           return -1;<br>    }<br> <br>diff --git a/main/dsp.c b/main/dsp.c<br>index 0609256..e3e1924 100644<br>--- a/main/dsp.c<br>+++ b/main/dsp.c<br>@@ -2404,17 +2404,18 @@<br> <br> int ast_dsp_init(void)<br> {<br>-       int res = _dsp_init(0);<br>+      if (_dsp_init(0)) {<br>+          return -1;<br>+   }<br> <br> #ifdef TEST_FRAMEWORK<br>- if (!res) {<br>-          AST_TEST_REGISTER(test_dsp_fax_detect);<br>-              AST_TEST_REGISTER(test_dsp_dtmf_detect);<br>+     AST_TEST_REGISTER(test_dsp_fax_detect);<br>+      AST_TEST_REGISTER(test_dsp_dtmf_detect);<br> <br>-          ast_register_cleanup(test_dsp_shutdown);<br>-     }<br>+    ast_register_cleanup(test_dsp_shutdown);<br> #endif<br>-    return res;<br>+<br>+       return 0;<br> }<br> <br> int ast_dsp_reload(void)<br>diff --git a/main/features.c b/main/features.c<br>index 2ca56bc..21e6c22 100644<br>--- a/main/features.c<br>+++ b/main/features.c<br>@@ -1167,17 +1167,10 @@<br>     int res;<br> <br>   res = ast_features_config_init();<br>-    if (res) {<br>-           return res;<br>-  }<br>     res |= ast_register_application2(app_bridge, bridge_exec, NULL, NULL, NULL);<br>  res |= ast_manager_register_xml_core("Bridge", EVENT_FLAG_CALL, action_bridge);<br> <br>- if (res) {<br>-           features_shutdown();<br>- } else {<br>-             ast_register_cleanup(features_shutdown);<br>-     }<br>+    ast_register_cleanup(features_shutdown);<br> <br>   return res;<br> }<br>diff --git a/main/features_config.c b/main/features_config.c<br>index e2d4057..3dac827 100644<br>--- a/main/features_config.c<br>+++ b/main/features_config.c<br>@@ -2000,9 +2000,5 @@<br>       res |= __ast_custom_function_register(&featuremap_function, NULL);<br>        res |= ast_cli_register_multiple(cli_features_config, ARRAY_LEN(cli_features_config));<br> <br>-    if (res) {<br>-           ast_features_config_shutdown();<br>-      }<br>-<br>  return res;<br> }<br>diff --git a/main/indications.c b/main/indications.c<br>index 4888680..8ca1068 100644<br>--- a/main/indications.c<br>+++ b/main/indications.c<br>@@ -1173,13 +1173,13 @@<br> /*! \brief Load indications module */<br> int ast_indications_init(void)<br> {<br>-       if (!(ast_tone_zones = ao2_container_alloc(NUM_TONE_ZONE_BUCKETS,<br>-                    ast_tone_zone_hash, ast_tone_zone_cmp))) {<br>+   ast_tone_zones = ao2_container_alloc(NUM_TONE_ZONE_BUCKETS,<br>+                  ast_tone_zone_hash, ast_tone_zone_cmp);<br>+      if (!ast_tone_zones) {<br>                return -1;<br>    }<br> <br>  if (load_indications(0)) {<br>-           indications_shutdown();<br>               return -1;<br>    }<br> <br>diff --git a/main/pbx_builtins.c b/main/pbx_builtins.c<br>index 605e0c9..44418b8 100644<br>--- a/main/pbx_builtins.c<br>+++ b/main/pbx_builtins.c<br>@@ -1433,7 +1433,6 @@<br>      for (x = 0; x < ARRAY_LEN(builtins); x++) {<br>                if (ast_register_application2(builtins[x].name, builtins[x].execute, NULL, NULL, NULL)) {<br>                     ast_log(LOG_ERROR, "Unable to register builtin application '%s'\n", builtins[x].name);<br>-                     unload_pbx_builtins();<br>                        return -1;<br>            }<br>     }<br>diff --git a/main/sorcery.c b/main/sorcery.c<br>index c20854f..2418ce3 100644<br>--- a/main/sorcery.c<br>+++ b/main/sorcery.c<br>@@ -383,20 +383,17 @@<br>     wizards = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, WIZARD_BUCKETS,<br>               ast_sorcery_internal_wizard_hash_fn, NULL, ast_sorcery_internal_wizard_cmp_fn);<br>       if (!wizards) {<br>-              sorcery_cleanup();<br>            return -1;<br>    }<br> <br>  observers = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_RWLOCK, 0, NULL, NULL);<br>       if (!observers) {<br>-            sorcery_cleanup();<br>            return -1;<br>    }<br> <br>  instances = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_RWLOCK, 0, INSTANCE_BUCKETS,<br>          ast_sorcery_hash_fn, NULL, ast_sorcery_cmp_fn);<br>       if (!instances) {<br>-            sorcery_cleanup();<br>            return -1;<br>    }<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8498">change 8498</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8498"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Iecc2df98008b21509925ff16740bd5fa29527db3 </div>
<div style="display:none"> Gerrit-Change-Number: 8498 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>