Hello,

looks like key value is null, which was not allowed by sql constaints. I don't see a reason to be null either here, can you send the output of 'bt full'?

Anyhow, for safety reasons, I committed to htable a safety check for such case in order to avoid crashing - now it is printing an error message.

Thanks,
Daniel

On 4/15/11 4:52 PM, Eric Hiller wrote:
Daniel,

Same it looks like each time:

Core was generated by `/usr/local/sbin/kamailio -f /usr/local/etc/kamailio/kamailio.cfg.diag.2'.
Program terminated with signal 11, Segmentation fault.
#0  0x00f22633 in ht_db_load_table (ht=0xb60f1af0, dbtable=0xb60f1b00, mode=0)
    at ht_db.c:244
244    kvalue.len = strlen(kvalue.s);
(gdb) where
#0  0x00f22633 in ht_db_load_table (ht=0xb60f1af0, dbtable=0xb60f1b00, mode=0)
    at ht_db.c:244
#1  0x00f19c12 in ht_db_load_tables () at ht_api.c:643
#2  0x00f18545 in mod_init () at htable.c:157
#3  0x081043a2 in init_mod (m=0x827ae30) at sr_module.c:872
#4  0x0810436a in init_mod (m=0x827aff0) at sr_module.c:852
#5  0x0810436a in init_mod (m=0x827b0d0) at sr_module.c:852
#6  0x0810436a in init_mod (m=0x827b1b0) at sr_module.c:852
#7  0x0810436a in init_mod (m=0x827b290) at sr_module.c:852
#8  0x0810436a in init_mod (m=0x827b370) at sr_module.c:852
#9  0x081051d3 in init_modules () at sr_module.c:902
#10 0x0809b6a5 in main (argc=3, argv=0xbfcc2464) at main.c:2187


Date: Fri, 15 Apr 2011 09:30:02 +0200
From: miconda@gmail.com
To: sr-users@lists.sip-router.org
CC: mrraptor98@hotmail.com
Subject: Re: [SR-Users] db_text issue

Hello,

On 4/15/11 5:58 AM, Eric Hiller wrote:
I would like to use dbtext to store a list of whitelisted gateways, but each time I load it I get a core segmentation fault.

Any ideas? Here is my gateways db file:
key_name(str) key_type(int) value_type(int) key_value(str)
gwip:1:0:a
gwip:1:0:b
gwip:1:0:c
gwcount:0:1:3

And in my config:
modparam("htable","htable","gateways=>size=4;dbtable=gateways;")
modparam("htable","db_url","text:///usr/local/etc/kamailio")

                while( $var(i) < $sht(gateways=>gwcount) ){
                        if( $sht(gateways=>gwip[$var(i)]) == $si ){
                                setflag(gateway);
                                xlog("ISFROMGW: request from IP $si matches $sht(gateways=>gwip[$var(i)]) ...\n");
                        }
                }

Do you see anything wrong with this setup?
do you get a core dump? Send the backtrace if yes.

Cheers,
Daniel
-- 
Daniel-Constantin Mierla
http://www.asipto.com

-- 
Daniel-Constantin Mierla
http://www.asipto.com