[sr-dev] [kamailio/kamailio] registrar: fix xavp_rcd memory consumption (#1111)

lazedo notifications at github.com
Tue May 16 15:42:55 CEST 2017


i didn't used kazoo for testing, but i will be adding a xavp_reset_list() to event processing (not critical).
test with this script with/without the patch.
have sip client re-register every 30 and you'll see `shm` memory consumption growing (`xavp_new_value`)
```
...
modparam("usrloc", "xavp_contact", "ulattrs")
modparam("registrar", "xavp_rcd", "ulrcd")
modparam("registrar", "xavp_cfg", "regcfg")
modparam("htable", "htable", "auth_cache=>size=16;autoexpire=7200;")
modparam("async", "workers", 2)

...

route
{
...
    if (is_method("REGISTER")) {
        route(REGISTRAR);
        exit();
    }

...
}

route[REGISTRAR]
{
    $xavp(regcfg=>match_received) = $su;
    if($sht(auth_cache=>$Au) != $null && registered("location", "$rz:$Au", 2, 1) == 1) {
        xlog("L_INFO", "$ci|register|found cached registration for $rz:$Au\n");
            $var(password) = $sht(auth_cache=>$Au);
            route(SAVE_LOCATION);
    }

    if( !is_present_hf("Authorization")) {
        auth_challenge("$fd", "0");
        exit();
    }
    
    async_route("MY_RESUME", "1");    

}

route[MY_RESUME]
{
    $xavp(ulattrs=>channel_vars) = '{"channel-vars" : true}';
    $xavp(ulattrs=>other_vars) = '{"other-vars" : false}';
    route(SAVE_LOCATION);
}

route[SAVE_LOCATION]
{
    if ($sht(auth_cache=>$Au) == $null) {
        xlog("L_INFO", "$ci|log|caching sip credentials for $Au\n");
    };
    $sht(auth_cache=>$Au) = $var(password);
    $var(save_result) = save("location", "0x04");
    if($var(save_result) == -1) {
        auth_challenge("$fd", "0");
        xlog("L_INFO", "$ci|end|issued auth challenge after failed attempt to save contact for $Au $si:$sp\n");
        exit;
    } else {
        if($var(save_result) == 1) {
            $var(new_reg) = "true";
        } else {
           $var(new_reg) = "false";
        }
    }
   xlog("L_INFO", "$ci|end|ulattrs $xavp(ulattrs=>channel_vars) , $xavp(ulattrs=>other_vars)\n");
    xlog("L_INFO", "$ci|end|save result $var(save_result) with with expires ($xavp(ulrcd=>expires)) contact $xavp(ulrcd=>ruid) : $ct\n");
}
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1111#issuecomment-301786093
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20170516/d9806c4c/attachment-0001.html>


More information about the sr-dev mailing list