[SR-Users] htable ::size has wrong value

Daniel-Constantin Mierla miconda at gmail.com
Tue May 24 21:09:53 CEST 2011


Hello,

On 5/24/11 4:40 PM, Juha Heinanen wrote:
> i have entries in htable with key name lpi::20033::prefix:
>
> # sip-proxy_ctl mi sht_dump htable | egrep 20033
> lpi::20033::prefix[0]:: +3583796294
> lpi::20033::prefix[1]:: +35837824030
> lpi::20033::prefix::size:: 1
>
> as you see in above, size of that key name is 1 although there clearly
> is two entries in the table with that key name.
>
> according to readme ::size is number of items:
>
> 3.7. array_size_suffix (str)
>
> The suffix to be added to store the number of items in an array.
>
> i verified with another key name where there was only one prefix, and
> then ::size was again 1.  so sometimes ::size is correct and sometimes
> incorrect.
>
> this looks like a serious bug to me.  any comments?
iirc, the value of *::size is set only when loading the values from 
database table. If you add/remove later, it is not updated. Then you 
should update it as you do changes in hash table, or use the variable 
counting the items by name:

http://www.kamailio.org/dokuwiki/doku.php/pseudovariables:3.1.x#shtcn_htable_regexp

If the value is invalid at startup/reload, then something is wrong, indeed.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
http://linkedin.com/in/miconda -- http://twitter.com/miconda




More information about the sr-users mailing list