- Add missing pkg_free for the dynamic PV name created during PV parsing
- Add missing pkg_free for any GPARAM_TYPE_PVS created during PV parsing
#### Pre-Submission Checklist
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
We are using NDB_REDIS in anger, fetching data from changing hash structures. NDB_REDIS creates dynamic PVs, and in order to do so it has a custom parser that allocates a dynamic PV structure as well as potentially multiple nested parameter structures. We very quickly found that we were running out of package memory, and enabling Kamailio's own memory debug logging quickly revealed that every `$redis(...)` query was leaking.
It appears that the allocated structures are only used within the subsequent handler to fetch the data. Therefore, to resolve the leak, the allocated structures are freed after the data for the PV in question has been fetched.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2536
-- Commit Summary --
* ndb_redis: Fix leaks from PV parsing
-- File Changes --
M src/modules/ndb_redis/ndb_redis_mod.c (24)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2536.patchhttps://github.com/kamailio/kamailio/pull/2536.diff
--
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/2536
# Description
We installed kamailio from the ubuntu package manager along with several of the modules, including `kamailio-python3-modules`, which gives us the app_python3 module.
We edited the default, provided config to add the lines
```
loadmodule "app_python3.so"
...
modparam("app_python3", "load", "my_cool_python_file.py")
```
Restarted kamailio and found the log messages below.
#### Log Messages
```
Oct 27 20:05:19 kamailio-stage-1 systemd[1]: Starting Kamailio SIP Server...
Oct 27 20:05:19 kamailio-stage-1 kamailio[2243329]: 0(2243329) ERROR: <core> [core/sr_module.c:512]: load_module(): could not open module </usr/lib/x86_64-linux-gnu/kamailio/modules/app_python3.so>: /usr/lib/x86_64-linux-gnu/kamailio/modules/app_python3.so: undefined symbol: PyExc_SystemExit
Oct 27 20:05:19 kamailio-stage-1 kamailio[2243329]: 0(2243329) CRITICAL: <core> [core/cfg.y:3536]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 266, column 12-27: failed to load module
Oct 27 20:05:19 kamailio-stage-1 kamailio[2243329]: 0(2243329) ERROR: <core> [core/modparam.c:176]: set_mod_param_regex(): No module matching <app_python3> found
Oct 27 20:05:19 kamailio-stage-1 kamailio[2243329]: 0(2243329) CRITICAL: <core> [core/cfg.y:3539]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 496, column 64: Can't set module parameter
```
### Additional Information
```
version: kamailio 5.3.2 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 9.2.1
```
* **Operating System**:
```
Linux kamailio-stage-1 5.4.0-1024-aws #24-Ubuntu SMP Sat Sep 5 06:19:55 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
```
`lsb_release -a`
```
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal
```
--
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/2534