[asterisk-dev] AST_MODULE_LOAD_FAILURE vs AST_MODULE_LOAD_DECLINE

Matt Fredrickson creslin at digium.com
Thu Apr 6 15:59:46 CDT 2017


On Wed, Apr 5, 2017 at 4:42 PM, Corey Farrell <git at cfware.com> wrote:
> Probably not the popular opinion, but I don't think any modules are
> "generally" important enough to abort Asterisk start-up.  For any module
> that is important enough for a system the admin can use 'require' or
> 'preload-require' settings in modules.conf.  The exception to this would be
> when a module creates an unstable state by being half-loaded (example:
> global symbols exported that will crash if called).

I tend to agree with that as well.  To follow the principle of least
surprise, Asterisk failing to start due to some module not being happy
due to say some configuration problem is surprising to me, versus not
working properly after Asterisk successfully loaded is less surprising
to me.

> On the 'core' side of things, anytime main/loader.c aborts start-up it
> should display an error message saying which module returned
> AST_MODULE_LOAD_FAILURE and make sure the logger gets flushed.  Even if
> every module gives a reason it is failing the module loader should still
> print a message (two errors on abort are better than possibly missing one).

+1

Matthew Fredrickson
Digium, Inc.

>
>
> On 04/05/2017 04:43 PM, George Joseph wrote:
>
> Over the years I've been frustrated at times where Asterisk fails to start
> for absolutely no (apparent) reason.  No error message, no trap, nothing.
> It just ends.  Every case of this I've tracked down has been the result of a
> module returning AST_MODULE_LOAD_FAILURE when it encounters a problem but
> not bothering to print an error first.   If you don't know already,
> AST_MODULE_LOAD_FAILURE tells asterisk to stop loading and exit.  What the
> module should have done was actually print an error and return
> AST_MODULE_LOAD_DECLINE which just tells asterisk that the module couldn't
> load.
>
> So now I'm doing an audit of module return codes to see which call FAILURE
> vs DECLINE and found the modules below all call FAILURE.
>
> The big question is...  Exactly which modules are so critical to asterisk
> that asterisk should exit if the module couldn't load?  Surely not all 103
> modules listed below.  If we can agree on the ones that really should call
> FAILURE, I'll update those with error messages, then change the rest to
> DECLINE and add error messages as needed.
>
> Reply with the list intact.  Don't add, remove, split or re-order the lines.
> Just stick an "F " before the modules you think should remain failure.
>
> Modules returning FAILURE:
>
> ./addons/app_mysql.c
> ./addons/cdr_mysql.c
> ./addons/chan_mobile.c
> ./apps/app_adsiprog.c
> ./apps/app_agent_pool.c
> ./apps/app_alarmreceiver.c
> ./apps/app_amd.c
> ./apps/app_authenticate.c
> ./apps/app_cdr.c
> ./apps/app_confbridge.c
> ./apps/app_festival.c
> ./apps/app_followme.c
> ./apps/app_forkcdr.c
> ./apps/app_meetme.c
> ./apps/app_queue.c
> ./apps/app_skel.c
> ./apps/app_voicemail.c
> ./cdr/cdr_custom.c
> ./cel/cel_custom.c
> ./cel/cel_odbc.c
> ./channels/chan_alsa.c
> ./channels/chan_console.c
> ./channels/chan_dahdi.c
> ./channels/chan_iax2.c
> ./channels/chan_mgcp.c
> ./channels/chan_misdn.c
> ./channels/chan_motif.c
> ./channels/chan_nbs.c
> ./channels/chan_oss.c
> ./channels/chan_phone.c
> ./channels/chan_pjsip.c
> ./channels/chan_sip.c
> ./channels/chan_skinny.c
> ./channels/chan_unistim.c
> ./channels/chan_vpb.cc
> ./codecs/codec_a_mu.c
> ./codecs/codec_adpcm.c
> ./codecs/codec_alaw.c
> ./codecs/codec_g722.c
> ./codecs/codec_g726.c
> ./codecs/codec_gsm.c
> ./codecs/codec_ilbc.c
> ./codecs/codec_lpc10.c
> ./codecs/codec_resample.c
> ./codecs/codec_ulaw.c
> ./formats/format_g723.c
> ./formats/format_g726.c
> ./formats/format_g729.c
> ./formats/format_gsm.c
> ./formats/format_h263.c
> ./formats/format_h264.c
> ./formats/format_ilbc.c
> ./formats/format_jpeg.c
> ./formats/format_ogg_vorbis.c
> ./formats/format_pcm.c
> ./formats/format_sln.c
> ./formats/format_vox.c
> ./formats/format_wav.c
> ./formats/format_wav_gsm.c
> ./funcs/func_cdr.c
> ./main/loader.c
> ./pbx/pbx_dundi.c
> ./pbx/pbx_loopback.c
> ./pbx/pbx_realtime.c
> ./pbx/pbx_spool.c
> ./res/res_pjsip/config_transport.c
> ./res/res_ari.c
> ./res/res_ari_events.c
> ./res/res_ari_model.c
> ./res/res_calendar.c
> ./res/res_chan_stats.c
> ./res/res_clialiases.c
> ./res/res_config_ldap.c
> ./res/res_config_sqlite.c
> ./res/res_config_sqlite3.c
> ./res/res_curl.c
> ./res/res_endpoint_stats.c
> ./res/res_fax.c
> ./res/res_hep_rtcp.c
> ./res/res_http_websocket.c
> ./res/res_musiconhold.c
> ./res/res_odbc.c
> ./res/res_phoneprov.c
> ./res/res_pjsip_nat.c
> ./res/res_pjsip_one_touch_record_info.c
> ./res/res_pjsip_outbound_publish.c
> ./res/res_pjsip_outbound_registration.c
> ./res/res_pjsip_sdp_rtp.c
> ./res/res_pjsip_send_to_voicemail.c
> ./res/res_pjsip_t38.c
> ./res/res_smdi.c
> ./res/res_snmp.c
> ./res/res_stasis.c
> ./res/res_stasis_device_state.c
> ./res/res_stasis_playback.c
> ./res/res_stasis_recording.c
> ./res/res_stasis_test.c
> ./res/res_statsd.c
> ./res/res_timing_kqueue.c
> ./res/res_xmpp.c
> ./res/res_pjsip_pubsub.c
> ./tests/test_bucket.c
> ./tests/test_channel_feature_hooks.c
>
> --
> George Joseph
> Digium, Inc. | Software Developer
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - US
> Check us out at: www.digium.com & www.asterisk.org
>
>
>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev



-- 
Matthew Fredrickson
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA



More information about the asterisk-dev mailing list