[SR-Users] ht_db_load_table(): key type must be string (type=6)

Daniel-Constantin Mierla miconda at gmail.com
Mon Apr 3 14:28:49 CEST 2017


Hello,

thanks for reminder, actually I missed that email, not reading it so far.

I just pushed a patch in master that should handle the blob/text columns:

  -
https://github.com/kamailio/kamailio/commit/24e729698017b5d898a92cdf7acb024e44252b84

Can you test it? If all ok, then I will backport.

Cheers,
Daniel


On 03.04.17 13:58, Ginhoux, Patrick wrote:
>
> Hi Daniel,
>
>  
>
> Do you look at this error with the item type of ‘text’ in a mysql table?
>
>  
>
> Cordialement
>
> Patrick GINHOUX
>
>  
>
> *De :*Ginhoux, Patrick
> *Envoyé :* vendredi 24 mars 2017 10:44
> *À :* 'Kamailio (SER) - Users Mailing List'
> <sr-users at lists.sip-router.org>
> *Objet :* RE: [SR-Users] ht_db_load_table(): key type must be string
> (type=6)
>
>  
>
> Hi Daniel,
>
>  
>
> I think that this key type problem has to do with the type of
> ‘text’used for some fields in my myqsl db.
>
>  
>
> By changing the type from ‘text’ to varchar(256), the problem goes away.
>
>  
>
> It is for sure just a workaround, that is ok for me for the moment,
> but in the case people would need to have text, we can get this
> problem back.
>
>  
>
> I hope this help.
>
>  
>
> Cordialement
>
> Patrick GINHOUX
>
>  
>
> *De :*Ginhoux, Patrick
> *Envoyé :* mardi 21 mars 2017 13:29
> *À :* Kamailio (SER) - Users Mailing List
> <sr-users at lists.sip-router.org <mailto:sr-users at lists.sip-router.org>>
> *Objet :* RE: [SR-Users] ht_db_load_table(): key type must be string
> (type=6)
>
>  
>
> Hi,
>
>  
>
> Below the structure of the properties table :
>
>  
>
> mysql> show create table properties;
>
> +------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
>
> | Table      | Create
> Table                                                                                                               
>                                                                                                                                                                            |
>
> +------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
>
> | properties | CREATE TABLE `properties` (
>
>   `id` int(6) unsigned NOT NULL AUTO_INCREMENT COMMENT 'UniqueID',
>
>   `key_name` text NOT NULL,
>
>   `key_value` text NOT NULL,
>
>   `value_type` int(1) NOT NULL,
>
>   `key_type` int(1) NOT NULL,
>
>   PRIMARY KEY (`id`)
>
> ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=latin1 |
>
> +------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
>
> 1 row in set (0.02 sec)
>
>  
>
> Cordialement
>
> Patrick GINHOUX
>
>  
>
> *De :*sr-users [mailto:sr-users-bounces at lists.sip-router.org] *De la
> part de* Daniel-Constantin Mierla
> *Envoyé :* mardi 21 mars 2017 13:25
> *À :* Kamailio (SER) - Users Mailing List
> <sr-users at lists.sip-router.org <mailto:sr-users at lists.sip-router.org>>
> *Objet :* Re: [SR-Users] ht_db_load_table(): key type must be string
> (type=6)
>
>  
>
> Hello,
>
> can you give the structure of the table properties (show create table
> ...)?
>
> Cheers,
>
> Daniel
>
> March 21, 2017 11:30 AM, "Ginhoux, Patrick"
> <patrick.ginhoux at fr.unisys.com
> <mailto:%22Ginhoux,%20Patrick%22%20%3cpatrick.ginhoux at fr.unisys.com%3e>>
> wrote:
>
>     Hi,
>
>     A second update for people who started to look at this issue.
>
>     I have identified the real cause of the problem by looking more in
>     the kamailio log with the debug traces. I discover that it is
>     related to the load of the properties table in the htable.
>
>     I have the following entries in my mysql db :
>
>     +-------+----------------+---------------------------------------------------------+------------+----------+
>
>     | id | key_name | key_value | value_type | key_type |
>
>     +-------+----------------+---------------------------------------------------------+------------+----------+
>
>     | 0 | VERSION | 120104-1734 | 0 | 0 |
>
>     | 1 | mmm-retry | 408=Y;502=Y;503=Y | 0 | 0 |
>
>     | 2 | mgcf-retry | 408=Y;502=Y;503=Y | 0 | 0 |
>
>     | 3 | max-mmm-retry | 2 | 0 | 0 |
>
>     | 4 | max-mgcf-retry | 2 | 0 | 0 |
>
>     | 5 | target-uri |
>     mgcf=10.10.10.10;mmm-legacy=20.20.20.10;mmm=20.20.20.20 | 0 | 0 |
>
>     | 6 | pike-status | 503 Service Overload | 0 | 0 |
>
>     | 7 | mgcf-path | 99 | 0 | 0 |
>
>     | 16 | mmm-nodeid | OPMMMS1VSE01=1;OPMMMS1VSE02=2 | 0 | 0 |
>
>     | 17 | mmm-node-path | 1=1;2=2 | 0 | 0 |
>
>     +-------+----------------+---------------------------------------------------------+------------+----------+
>
>     In the kamailio.cfg, the << modparam("htable", "htable",
>     "propertiesHash=>size=4;dbtable=properties;") >> command causes
>     the load of the above table in the htable.
>
>     In the log we can see, that the load is done in the alphabetic
>     order of the key_name and it fails to load the last entry “VERSION” :
>
>     Mar 21 10:25:28 localhost /usr/sbin/kamailio[5784]: DEBUG: <core>
>     [db_val.c:169]: db_str2val(): converting BLOB [VERSION]
>
>     Mar 21 10:25:28 localhost /usr/sbin/kamailio[5784]: DEBUG: <core>
>     [db_val.c:74]: db_str2val(): converting INT [0]
>
>     Mar 21 10:25:28 localhost /usr/sbin/kamailio[5784]: DEBUG: <core>
>     [db_val.c:74]: db_str2val(): converting INT [0]
>
>     Mar 21 10:25:28 localhost /usr/sbin/kamailio[5784]: DEBUG: <core>
>     [db_val.c:169]: db_str2val(): converting BLOB [120104-1734]
>
>     Mar 21 10:25:28 localhost /usr/sbin/kamailio[5784]: ERROR: htable
>     [ht_db.c:276]: ht_db_load_table(): key type must be string (type=6)
>
>     If I add a new entry named “WWWWW”, then the failure occurs on
>     this entry that is the last alphabetic entry :
>
>     | 10000 | WWWWW | toto | 0 | 0 |
>
>     Mar 21 10:28:45 localhost /usr/sbin/kamailio[5817]: DEBUG: <core>
>     [db_val.c:169]: db_str2val(): converting BLOB [WWWWW]
>
>     Mar 21 10:28:45 localhost /usr/sbin/kamailio[5817]: DEBUG: <core>
>     [db_val.c:74]: db_str2val(): converting INT [0]
>
>     Mar 21 10:28:45 localhost /usr/sbin/kamailio[5817]: DEBUG: <core>
>     [db_val.c:74]: db_str2val(): converting INT [0]
>
>     Mar 21 10:28:45 localhost /usr/sbin/kamailio[5817]: DEBUG: <core>
>     [db_val.c:169]: db_str2val(): converting BLOB [toto]
>
>     Mar 21 10:28:45 localhost /usr/sbin/kamailio[5817]: ERROR: htable
>     [ht_db.c:276]: ht_db_load_table(): key type must be string (type=6)
>
>     Attached the kamailio log for each test.
>
>     I hope this help.
>
>     Have anyone an idea of this problem ?
>
>     Cordialement
>
>     Patrick GINHOUX
>
>     *De :*Ginhoux, Patrick
>     *Envoyé :* mardi 21 mars 2017 09:41
>     *À :* Kamailio users (sr-users at lists.sip-router.org
>     <mailto:sr-users at lists.sip-router.org>)
>     <sr-users at lists.sip-router.org <mailto:sr-users at lists.sip-router.org>>
>     *Objet :* RE: ht_db_load_table(): key type must be string (type=6)
>
>     Hi,
>
>     There was a mistake in the file attached ; the short kamailio.cfg
>     file (that makes kamailio to start) was not the correct one;
>     attached the correct one.
>
>     Have anyone an idea of this problem ?
>
>     Cordialement
>
>     Patrick GINHOUX
>
>     *De :*Ginhoux, Patrick
>     *Envoyé :* lundi 20 mars 2017 17:58
>     *À :* Kamailio users (sr-users at lists.sip-router.org
>     <mailto:sr-users at lists.sip-router.org>)
>     <sr-users at lists.sip-router.org <mailto:sr-users at lists.sip-router.org>>
>     *Objet :* RE: ht_db_load_table(): key type must be string (type=6)
>
>     Hi,
>
>     To figure out what causes this issue, I work to shorten my
>     kamailio.cfg to contains loadmodule/modparam instructions for the
>     htable module only.
>
>     My first attempt (see kamailio.cfg.ok) shows that the problem
>     doesn’t occur.
>
>     In the second attempt (see kamailio.cfg.ko) I add instructions
>     previously removed from the original .cfg file. I have determined
>     that, depending on the instructions that follows the
>     “modparam("htable", "fetch_rows", 1000)” line, the “key type must
>     be string (type=6)” error occurs or not.
>
>     In this ko file, if I comment out the following sequence, the
>     error occurs :
>
>     modparam("htable", "fetch_rows", 1000)
>
>     #!!ifdef FIXED_ROUTING
>
>     #modparam("htable", "htable",
>     "mbxrangeHash=>size=4;dbtable=mbxrange;")
>
>     #!!else
>
>     #modparam("htable", "htable", "abpqHash=>size=12;dbtable=abpq;")
>
>     #modparam("htable", "htable", "zabpqHash=>size=12;dbtable=zabpq;")
>
>     #!!endif
>
>     modparam("htable", "htable",
>     "propertiesHash=>size=4;dbtable=properties;")
>
>     I hope my explanation is clearn and there are people who can help
>     me on this problem that causes kamailio to not start.
>
>     Cordialement
>
>     Patrick GINHOUX
>
>     *De :*Ginhoux, Patrick
>     *Envoyé :* vendredi 17 mars 2017 15:46
>     *À :* Kamailio users (sr-users at lists.sip-router.org
>     <mailto:sr-users at lists.sip-router.org>)
>     <sr-users at lists.sip-router.org <mailto:sr-users at lists.sip-router.org>>
>     *Objet :* ht_db_load_table(): key type must be string (type=6)
>
>     Hi,
>
>     Now the kamailio installation is completed, I try to start
>     kamailio but got an error on a modparam line.
>
>     By looking at the kamailio.cfg (with debug mode) it looks like the
>     instruction is not correct :
>
>     modparam("htable", "fetch_rows", 1000)
>
>     [root at vm-vse02-siprouter1 ~]# systemctl status kamailio.service -l
>
>     kamailio.service - SYSV: Kamailio is a fast, reliable and flexible
>     SIP Server.
>
>     Loaded: loaded (/etc/rc.d/init.d/kamailio)
>
>     Active: failed (Result: exit-code) since Fri 2017-03-17 15:38:13
>     CET; 17s ago
>
>     Process: 1526 ExecStart=/etc/rc.d/init.d/kamailio start
>     (code=exited, status=1/FAILURE)
>
>     Mar 17 15:38:13 vm-vse02-siprouter1 /usr/sbin/kamailio[1539]:
>     INFO: pike [pike.c:99]: pike_init(): PIKE - initializing
>
>     Mar 17 15:38:13 vm-vse02-siprouter1 /usr/sbin/kamailio[1539]:
>     INFO: pike [ip_tree.c:81]: init_lock_set(): probing 256 set size
>
>     Mar 17 15:38:13 vm-vse02-siprouter1 /usr/sbin/kamailio[1539]:
>     INFO: cfgutils [cfgutils.c:767]: mod_init(): no hash_file given,
>     disable hash functionality
>
>     Mar 17 15:38:13 vm-vse02-siprouter1 /usr/sbin/kamailio[1539]:
>     ERROR: htable [ht_db.c:276]: ht_db_load_table(): key type must be
>     string (type=6)
>
>     Mar 17 15:38:13 vm-vse02-siprouter1 /usr/sbin/kamailio[1539]:
>     ERROR: <core> [core/sr_module.c:968]: init_mod(): Error while
>     initializing module htable (/usr/lib64/kamailio/modules/htable.so)
>
>     Mar 17 15:38:13 vm-vse02-siprouter1 /usr/sbin/kamailio[1539]:
>     INFO: <core> [core/sctp_core.c:53]: sctp_core_destroy(): SCTP API
>     not initialized
>
>     Mar 17 15:38:13 vm-vse02-siprouter1 kamailio[1526]: Starting kamailio:
>
>     Mar 17 15:38:13 vm-vse02-siprouter1 systemd[1]: kamailio.service:
>     control process exited, code=exited status=1
>
>     Mar 17 15:38:13 vm-vse02-siprouter1 systemd[1]: Failed to start
>     SYSV: Kamailio is a fast, reliable and flexible SIP Server..
>
>     Mar 17 15:38:13 vm-vse02-siprouter1 systemd[1]: Unit
>     kamailio.service entered failed state.
>
>     [root at vm-vse02-siprouter1 ~]#
>
>     modparam("htable", "fetch_rows", “1000”)
>
>     [root at vm-vse02-siprouter1 ~]# systemctl status kamailio.service -l
>
>     kamailio.service - SYSV: Kamailio is a fast, reliable and flexible
>     SIP Server.
>
>     Loaded: loaded (/etc/rc.d/init.d/kamailio)
>
>     Active: failed (Result: exit-code) since Fri 2017-03-17 15:26:21
>     CET; 3s ago
>
>     Process: 1452 ExecStart=/etc/rc.d/init.d/kamailio start
>     (code=exited, status=1/FAILURE)
>
>     Mar 17 15:26:20 vm-vse02-siprouter1 systemd[1]: Starting SYSV:
>     Kamailio is a fast, reliable and flexible SIP Server....
>
>     Mar 17 15:26:21 vm-vse02-siprouter1 kamailio[1452]: Not starting :
>     invalid configuration file!
>
>     Mar 17 15:26:21 vm-vse02-siprouter1 kamailio[1452]: 0(1460) ERROR:
>     <core> [core/modparam.c:141]: set_mod_param_regex(): parameter
>     <fetch_rows> of type <1> not found in module <htable>
>
>     Mar 17 15:26:21 vm-vse02-siprouter1 kamailio[1452]: 0(1460)
>     CRITICAL: <core> [core/cfg.y:3404]: yyerror_at(): parse error in
>     config file //etc/kamailio/kamailio.cfg, line 308, column 41:
>     Can't set module parameter
>
>     Mar 17 15:26:21 vm-vse02-siprouter1 kamailio[1452]: 0(1460)
>     WARNING: <core> [core/cfg.y:3378]: warn_at(): warning in config
>     file //etc/kamailio/kamailio.cfg, line 971, column 6-13: constant
>     value in if(...)
>
>     Mar 17 15:26:21 vm-vse02-siprouter1 kamailio[1452]: ERROR: bad
>     config file (1 errors)
>
>     Mar 17 15:26:21 vm-vse02-siprouter1 kamailio[1452]: 0(1460) INFO:
>     <core> [core/sctp_core.c:53]: sctp_core_destroy(): SCTP API not
>     initialized
>
>     Mar 17 15:26:21 vm-vse02-siprouter1 systemd[1]: kamailio.service:
>     control process exited, code=exited status=1
>
>     Mar 17 15:26:21 vm-vse02-siprouter1 systemd[1]: Failed to start
>     SYSV: Kamailio is a fast, reliable and flexible SIP Server..
>
>     Mar 17 15:26:21 vm-vse02-siprouter1 systemd[1]: Unit
>     kamailio.service entered failed state.
>
>     [root at vm-vse02-siprouter1 ~]#
>
>     The documentation shows that fetch_rows is an integer :
>
>     */fetch_rows/**/(integer)/*
>
>     How many rows to fetch at once from database.
>
>     /Default value is 100. /
>
>     *Example 1.12. Set **fetch_rows**parameter*
>
>     ...
>
>     modparam("htable", "fetch_rows", 1000)
>
>     So how to explain the first error.
>
>     Have you any thoughts on this case ?
>
>     Cordialement
>
>     Patrick GINHOUX
>
>
>
> --
> Daniel-Constantin Mierla
> www.kamailio.org <http://www.kamailio.org> -- www.asipto.com
> <http://www.asipto.com>
>

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - May 22-24 (USA) - www.asipto.com
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20170403/be6130cb/attachment.html>


More information about the sr-users mailing list