Hi,

Seems there are some serious problems with db_perlvdb. It gives segmentation fault as soon as i set it as db url for any module e.g. acc, sip_trace, msilo and so on.


Here is back-trace of core dump,

--
#0  0xb57653dd in parseurl (url=0xaf41ba5c "\340\352\245\266\062") at perlvdbfunc.c:60
        cn = 0x1 <Address 0x1 out of bounds>
#1  0xb5765af6 in perlvdb_db_init (url=0xaf41ba5c "\340\352\245\266\062") at perlvdbfunc.c:123
        res = 0x5
        cn = 0xaf539cdb "\270"
        obj = 0x0
        consize = 32
        __FUNCTION__ = "perlvdb_db_init"
#2  0xaf3f81c2 in mod_init () at msilo.c:335
        avp_spec = {type = PVT_AVP, getf = 0xb5f86c50 <pv_get_avp>, setf = 0xb5f8a8a2 <pv_set_avp>, pvp = {pvn = {type = 0, nfree = 0, u = {
                isname = {type = 1, name = {n = -1230637607, s = {s = 0xb6a5f5d9 "msilo_extra_hdrs)", len = 16}, re = 0xb6a5f5d9}}, 
                dname = 0x1}}, pvi = {type = 0, u = {ival = 0, dval = 0x0}}}, trans = 0x0}
        __FUNCTION__ = "mod_init"
#3  0x081e6b7c in init_mod (m=0xb6a4d9b0) at core/sr_module.c:972
        __FUNCTION__ = "init_mod"
#4  0x081e6e82 in init_modules () at core/sr_module.c:1001
        t = 0x544c1e2c
        i = -1
        __FUNCTION__ = "init_modules"
--


Thank you.



On Fri, May 4, 2018 at 7:29 PM, M S <shaheryarkh@gmail.com> wrote:
Hi,

I am trying to load db_perlvdb.so module using latest Kamailio branch v5.0.6 with git revision 49bd81ad7856dac9b2efd53597fb1c182de7440b on Debian Wheezy 32bit. The compilation and installation went successful however the module gives following error.

--
May  4 19:03:59 webrtc[8895]: INFO: app_perl [app_perl_mod.c:351]: mod_init(): perl interpreter has been initialized (1525453439.237584 => 1525453439.454432)
May  4 19:03:59 webrtc[8895]: CRITICAL: db_perlvdb [db_perlvdb.c:79]: mod_init(): perl module not loaded. Exiting.
May  4 19:03:59 webrtc[8895]: ERROR: <core> [core/sr_module.c:970]: init_mod(): Error while initializing module db_perlvdb (/usr/local/adx-webrtc/lib/kamailio/modules/db_perlvdb.so)
--


I tried to find module perl.so in modules folder of kamailio installation but there is none. Then i looked through the source code but no success.

After some googling, i found following link which states that perl.so was remained to app_perl.so since v4.x.

I have created a small patch for db_perlvdb.c which corrects this error.


--
diff --git a/src/modules/db_perlvdb/db_perlvdb.c b/src/modules/db_perlvdb/db_perlvdb.c
index 7a2b63e..266ece2 100644
--- a/src/modules/db_perlvdb/db_perlvdb.c
+++ b/src/modules/db_perlvdb/db_perlvdb.c
@@ -75,8 +75,8 @@ struct module_exports exports = {
 
 static int mod_init(void)
 {
-    if (!module_loaded("perl")) {
-        LM_CRIT("perl module not loaded. Exiting.\n");
+    if (!module_loaded("app_perl")) {
+        LM_CRIT("app_perl module not loaded. Exiting.\n");
         return -1;
     }
--


Kindly update Kamailio master and branch trunks.


Thank you.