|Summary:||ASTERISK-18227: Manual module loading (with global symbols) broken since 1.4.28|
|Reporter:||Daniel Ferrer (dferrer)||Labels:|
|Date Opened:||2011-08-05 10:32:34||Date Closed:||2011-09-12 15:04:38|
|Environment:||Attachments:||( 0) asterisk14-module_load_globalsym.diff|
( 1) asterisk160-module_load_globalsym.diff
|Description:||Can't load manually a module that exports global symbols, after asterisk boot. The module loads perfectly at asterisk boot via autoloading.|
Try following example:
- Configure modules.conf to not autoloading res_monitor.so adding the following line:
noload => res_monitor.so
- Start asterisk and try to load app_queue.so that depends on symbols exported by res_monitor.so
*CLI> module load res_monitor.so
== Registered application 'Monitor'
== Registered application 'StopMonitor'
== Registered application 'ChangeMonitor'
== Registered application 'PauseMonitor'
== Registered application 'UnpauseMonitor'
== Manager registered action Monitor
== Manager registered action StopMonitor
== Manager registered action ChangeMonitor
== Manager registered action PauseMonitor
== Manager registered action UnpauseMonitor
Loaded res_monitor.so => (Call Monitoring Resource)
*CLI> module load app_queue.so
[2011-08-05 11:36:10] WARNING: loader.c:433 load_dynamic_module: Error loading module 'app_queue.so': /usr/lib/asterisk/modules/app_queue.so: undefined symbol: ast_monitor_start
[2011-08-05 11:36:10] WARNING: loader.c:761 load_resource: Module 'app_queue.so' could not be loaded.
Module cant be loaded because res_monitor didn't exported its symbols when manual loading.
This bug was introduced in r233782, r233879 that added AST_MODFLAG_LOAD_FIRST to autoload first format_* modules. Manual loading calls 'load_dynamic_module' with LOAD_ALL flag, and looking at the code, it doesn't set variable 'wants_global', that makes a dlopen with flags 'RTLD_LAZY | RTLD_GLOBAL' to export global symbols.
The only way to load module is at asterisk boot with autoloading (we enter on switch case LOAD_GLOBAL_SYMBOLS and set wants_global variable).
This is broken since 1.4.28, and aparently only affects 1.4 branch and 1.6.0 branch as Russell says in reviewboard 445 (associated with the commit that introduced the bug).
I'm attaching a patch for 1.4 and 1.6.0.
|Comments:||By: Daniel Ferrer (dferrer) 2011-08-05 10:36:14.677-0500|
Patch for 1.4 branch
By: Daniel Ferrer (dferrer) 2011-08-05 10:39:15.536-0500
Patch for 1.6.0 branch
By: Leif Madsen (lmadsen) 2011-09-12 15:04:29.461-0500
Per the Asterisk maintenance timeline page at http://www.asterisk.org/asterisk-versions maintenance (bug) support for the 1.4 and 1.6.x branches has ended. For continued maintenance support please move to the 1.8 branch which is a long term support (LTS) branch. For more information about branch support, please see https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions. After testing with Asterisk 1.8, if you find this problem has not been resolved, please open a new issue against Asterisk 1.8.
Thanks for the submission! I'm closing this issue though per the message above.