Hi,
I just tried to send numbers of SIP register to kamailio (release 5.8.2). It is reported that there are some memory leakage in shared memory after the expiry of all the registration sessions. After drill down the code. function save_pending(...) is called. (in ims_registrar_pcscf/save.c). Inside that function, it seems that "sec_verify_params" is not deallocated upon the function completes.
Findings: - sec_verify_params uses the result from function cscf_get_security_verify(...) - Function cscf_get_security_verify(...) returns the result of function parse_sec_agree(...) - Function parse_sec_agree(...) returns "params" where "shm_malloc(...)" is called
It seems that the memory pointed by 'sec_verify_params' is not further referenced by others. Should shm_free(...) be called when leaving function save_pending(...) in order to free the unused memory of 'sec_verify_params'?
Please advice.
Thank you.
Regards, Hong
Hello,
thanks for the report. It would be great if you could create a pull-request on our github tracker about the suggested change in the module, to make it easier to review and possible merge to the code base.
Thanks,
Henning
Hello,
Thanks for the reply.
I just tried that again on the latest kamailio 5.8.3. The same memory leak symptom happens. After handling 100 registrations, and after all the 100 registrations expires, the Memory still-in-use summary (shm) report shows that there is memory leak related to ipsec.
Sep 9 18:20:02 imstester04 /usr/local/sbin/kamailio[3146387]: WARNING: <core> [main.c:644]: cleanup(): Memory still-in-use summary (shm): Sep 9 18:20:02 imstester04 /usr/local/sbin/kamailio[3146387]: WARNING: qm_sums: qm_sums(): summarizing all alloc'ed. fragments: ... Sep 9 18:20:02 imstester04 /usr/local/sbin/kamailio[3146387]: WARNING: qm_sums: qm_sums(): count= 100 size= 5520 bytes from ims_ipsec_pcscf: sec_agree.c: parse_sec_agree(142) Sep 9 18:20:02 imstester04 /usr/local/sbin/kamailio[3146387]: WARNING: qm_sums: qm_sums(): count= 100 size= 1952 bytes from ims_ipsec_pcscf: sec_agree.c: parse_sec_agree(149) Sep 9 18:20:02 imstester04 /usr/local/sbin/kamailio[3146387]: WARNING: qm_sums: qm_sums(): count= 100 size= 1600 bytes from ims_registrar_pcscf: sec_agree.c: parse_sec_agree(139) Sep 9 18:20:02 imstester04 /usr/local/sbin/kamailio[3146387]: WARNING: qm_sums: qm_sums(): count= 100 size= 4816 bytes from ims_registrar_pcscf: sec_agree.c: parse_sec_agree(132) Sep 9 18:20:02 imstester04 /usr/local/sbin/kamailio[3146387]: WARNING: qm_sums: qm_sums(): count= 200 size= 3664 bytes from ims_registrar_pcscf: sec_agree.c: process_sec_agree_param(90) Sep 9 18:20:02 imstester04 /usr/local/sbin/kamailio[3146387]: WARNING: qm_sums: qm_sums(): count= 200 size= 3360 bytes from ims_registrar_pcscf: sec_agree.c: process_sec_agree_param(84) Sep 9 18:20:02 imstester04 /usr/local/sbin/kamailio[3146387]: WARNING: qm_sums: qm_sums(): count= 200 size= 4192 bytes from ims_registrar_pcscf: sec_agree.c: process_sec_agree_param(88) Sep 9 18:20:02 imstester04 /usr/local/sbin/kamailio[3146387]: WARNING: qm_sums: qm_sums(): count= 200 size= 3776 bytes from ims_registrar_pcscf: sec_agree.c: process_sec_agree_param(86) Sep 9 18:20:02 imstester04 /usr/local/sbin/kamailio[3146387]: WARNING: qm_sums: qm_sums(): count= 200 size= 35952 bytes from ims_registrar_pcscf: sec_agree.c: parse_sec_agree(148)
Any idea on that? Please advise.
Thank you.
Regards, Hong