<p>i didn't used kazoo for testing, but i will be adding a xavp_reset_list() to event processing (not critical).<br>
test with this script with/without the patch.<br>
have sip client re-register every 30 and you'll see <code>shm</code> memory consumption growing (<code>xavp_new_value</code>)</p>
<pre><code>...
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");
}
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/1111#issuecomment-301786093">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZW6DK7SR0X5CTAZNuZg5DrrL2FQ-ks5r6affgaJpZM4NOAPn">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZXeTSakYY8JelIQni0k-QsLfXYQJks5r6affgaJpZM4NOAPn.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/pull/1111#issuecomment-301786093"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@lazedo in #1111: i didn't used kazoo for testing, but i will be adding a xavp_reset_list() to event processing (not critical).\r\ntest with this script with/without the patch.\r\nhave sip client re-register every 30 and you'll see `shm` memory consumption growing (`xavp_new_value`)\r\n```\r\n...\r\nmodparam(\"usrloc\", \"xavp_contact\", \"ulattrs\")\r\nmodparam(\"registrar\", \"xavp_rcd\", \"ulrcd\")\r\nmodparam(\"registrar\", \"xavp_cfg\", \"regcfg\")\r\nmodparam(\"htable\", \"htable\", \"auth_cache=\u003esize=16;autoexpire=7200;\")\r\nmodparam(\"async\", \"workers\", 2)\r\n\r\n...\r\n\r\nroute\r\n{\r\n...\r\n    if (is_method(\"REGISTER\")) {\r\n        route(REGISTRAR);\r\n        exit();\r\n    }\r\n\r\n...\r\n}\r\n\r\nroute[REGISTRAR]\r\n{\r\n    $xavp(regcfg=\u003ematch_received) = $su;\r\n    if($sht(auth_cache=\u003e$Au) != $null \u0026\u0026 registered(\"location\", \"$rz:$Au\", 2, 1) == 1) {\r\n        xlog(\"L_INFO\", \"$ci|register|found cached registration for $rz:$Au\\n\");\r\n            $var(password) = $sht(auth_cache=\u003e$Au);\r\n            route(SAVE_LOCATION);\r\n    }\r\n\r\n    if( !is_present_hf(\"Authorization\")) {\r\n        auth_challenge(\"$fd\", \"0\");\r\n        exit();\r\n    }\r\n    \r\n    async_route(\"MY_RESUME\", \"1\");    \r\n\r\n}\r\n\r\nroute[MY_RESUME]\r\n{\r\n    $xavp(ulattrs=\u003echannel_vars) = '{\"channel-vars\" : true}';\r\n    $xavp(ulattrs=\u003eother_vars) = '{\"other-vars\" : false}';\r\n    route(SAVE_LOCATION);\r\n}\r\n\r\nroute[SAVE_LOCATION]\r\n{\r\n    if ($sht(auth_cache=\u003e$Au) == $null) {\r\n        xlog(\"L_INFO\", \"$ci|log|caching sip credentials for $Au\\n\");\r\n    };\r\n    $sht(auth_cache=\u003e$Au) = $var(password);\r\n    $var(save_result) = save(\"location\", \"0x04\");\r\n    if($var(save_result) == -1) {\r\n        auth_challenge(\"$fd\", \"0\");\r\n        xlog(\"L_INFO\", \"$ci|end|issued auth challenge after failed attempt to save contact for $Au $si:$sp\\n\");\r\n        exit;\r\n    } else {\r\n        if($var(save_result) == 1) {\r\n            $var(new_reg) = \"true\";\r\n        } else {\r\n           $var(new_reg) = \"false\";\r\n        }\r\n    }\r\n   xlog(\"L_INFO\", \"$ci|end|ulattrs $xavp(ulattrs=\u003echannel_vars) , $xavp(ulattrs=\u003eother_vars)\\n\");\r\n    xlog(\"L_INFO\", \"$ci|end|save result $var(save_result) with with expires ($xavp(ulrcd=\u003eexpires)) contact $xavp(ulrcd=\u003eruid) : $ct\\n\");\r\n}\r\n```\r\n"}],"action":{"name":"View Pull Request","url":"https://github.com/kamailio/kamailio/pull/1111#issuecomment-301786093"}}}</script>