[sr-dev] [kamailio/kamailio] cfgutils route_if_exists causing leak (#1503)

Julien Chavanton notifications at github.com
Thu Apr 19 18:21:05 CEST 2018


<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests.

If you have questions about using Kamailio or related to its configuration file,
ask on sr-users mailing list:

  * http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

If you have questions about developing extensions to Kamailio or its existing
C code, ask on sr-dev mailing list

  * http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Please try to fill this template as much as possible for any issue. It helps the
developers to troubleshoot the issue.

If you submit a feature request (or enhancement), you can delete the text of
the template and only add the description of what you would like to be added.

If there is no content to be filled in a section, the entire section can be removed.

You can delete the comments from the template sections when filling.

You can delete next line and everything above before submitting (it is a comment).
-->

### Description
cfgutils route_if_exists can leak when
1: using a $var or $avp
2: some functions are called within the called route

### Troubleshooting

#### Reproduction


Note the route is executed from `rtimer` in case this is part of the problem somehow.
```
modparam("rtimer", "timer", "name=tmetrics;interval=9;mode=1;")
modparam("rtimer", "exec", "timer=tmetrics;route=test")
```
example :
```
route[dummy] {
        xinfo("[dummy]");
        statsd_gauge("dummy_1xx", $stat(1xx_replies));
}
route[test] {
        $var(route_name) = "dummy";
        route_if_exists($var(route_name));
]
```
working alternative
```
route[dummy] {
        xinfo("[dummy]");
        statsd_gauge("dummy_1xx", $stat(1xx_replies));
}
route[test] {
        $var(route_name) = "dummy";
        if (check_route_exists($var(route_name))) {
                     route($var(route_name));
       } 
}
```


#### Debugging Data
```
kamcmd pkg.stats you can see the `real_used` of the timer process with leak every time the route is called
```


-- 
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/issues/1503
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20180419/1630dce8/attachment.html>


More information about the sr-dev mailing list