[asterisk-bugs] [JIRA] (ASTERISK-29148) AST_MODULE_INFO no, MODULEINFO depend

Alexander Traud (JIRA) noreply at issues.asterisk.org
Mon Nov 2 01:25:15 CST 2020


Alexander Traud created ASTERISK-29148:
------------------------------------------

             Summary: AST_MODULE_INFO no, MODULEINFO depend
                 Key: ASTERISK-29148
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29148
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: General
    Affects Versions: 18.0.0, 16.14.0
            Reporter: Alexander Traud
            Severity: Trivial


Found this, while debugging the channel driver {{chan_sip}} while {{noload => res_pjsip}}. Commit [9cfdb81|https://gerrit.asterisk.org/7872] added ‘.requires’ to AST_MODULE_INFO: The listed modules get required at runtime. 34 months later, that change is still not complete because much more requirements exit. This is a follow-up to
* ASTERISK-28789 which looked at *use/require* and
* ASTERISK-28838 which looked at *no/require*

Here, the topic is *depend/no*:
MODULEINFO declares other modules as dependencies at build-time. At runtime, those dependencies are still required. Consequently, each ‘depend’ in MODULEINFO has to be copied over to ‘.requires’ in AST_MODULE_INFO.

In other words, if an Asterisk module is loaded at runtime, its Linux shared library is loaded. When such a module/library does not find all its dependencies, the command-line interface prints the missing symbols. Those are quite cryptic. Therefore, is not always obvious which module is required. For that, ‘.requires’ in AST_MODULE_INFO helps because it prints not the missing symbol(s) names but the missing module(s) names.

For example, {{noload => res_pjsip_session}} in the configurations file {{/etc/asterisk/modules.conf}} gives:{code}ERROR: loader.c:2396 load_modules: Error loading module 'res_hep_pjsip.so': /usr/lib/asterisk/modules/res_hep_pjsip.so: undefined symbol: ast_sip_dialog_get_session{code}Actually, I expected the same for the new module {{res_pjsip_stir_shaken}}. However, it does not depend/require on {{res_pjsip_session}} actually, because the two used symbols got moved to {{res_pjsip}} in commit [7d04544|https://gerrit.asterisk.org/6647]. Nevertheless, for symmetry, I also enhanced {{res_pjsip_stir_shaken}}, too.

{{noload => res_sorcery_memory.so}} gives:
{code}ERROR: sorcery.c:886 __ast_sorcery_object_type_insert_wizard: Wizard 'memory' could not be applied to object type 'nat_hook' as it was not found
ERROR: res_pjsip/pjsip_configuration.c:2011 ast_res_pjsip_initialize_configuration: Failed to register nat_hook{code}This is special because the module still starts. Consequently, it raises the question whether (A) the originating MODULEINFO depend is correct. or whether (B) the failure code in module {{res_pjsip}} is correct.

{{noload => res_pjsip}} gives:
{code}ERROR: loader.c:2396 load_modules: Error loading module 'res_prometheus.so': /usr/lib/asterisk/modules/res_prometheus.so: undefined symbol: ast_sip_get_sorcery{code}This is special because it does not list the module {{res_pjsip}} as MODULEINFO depend. This is because it can be build without PJProject. However, in that case, it has to be optional in MODULEINFO and conditional in AST_MODULE_INFO.

{{noload => res_sorcery_config.so}} gives:
{code}ERROR: sorcery.c:886 __ast_sorcery_object_type_insert_wizard: Wizard 'config' could not be applied to object type 'log_mappings' as it was not found
WARNING: res_pjproject.c:665 load_module: Failed to register pjproject log_mappings object with sorcery
ERROR: loader.c:2396 load_modules: res_pjproject declined to load.{code}This unveiled a previously unmentioned dependency.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list