Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Leak in t_uac_dlg Mi function #298

Closed
cygnusb opened this issue Aug 24, 2015 · 4 comments
Closed

Memory Leak in t_uac_dlg Mi function #298

cygnusb opened this issue Aug 24, 2015 · 4 comments

Comments

@cygnusb
Copy link

cygnusb commented Aug 24, 2015

We are using the t_uac_dlg function through a UDP MI Datagram to create local SIP/TCP requests. We are seeing a memory leak of increasing shared Memory usage, which is increasing at the same rate as tcp connections are created (tested under 4.0.1 and 4.3.1).

/usr/sbin/kamailio[25407]: NOTICE: fm_status:  count= 71943 size=  14126536 bytes from mi_datagram: datagram_fnc.c: build_async_handler(387)

After looking at the memory dump and investigating the source, I guess that the memory leak is created, when the

MI_ASYNC_RPL_FLAG

is set. This seems to be set by:

modules/tmx/tmx_mod.c:  {MI_TM_UAC,     mi_tm_uac_dlg,   MI_ASYNC_RPL_FLAG,  0,  0 },

only, which we are using heavily.

Can someone please give me a hint, where to search for the memory leak. My guess is that:

modules/mi_datagram/datagram_fnc.c:489

if (f->flags&MI_ASYNC_RPL_FLAG) {
    hdl = build_async_handler(mi_socket_domain,
    (struct sockaddr* )&reply_addr, reply_addr_len);

the handler is not correctly freed up in the async reply case.

Thank you!

Greetings

@miconda
Copy link
Member

miconda commented Aug 25, 2015

I just pushed a patch to master branch 374bfb1 -- can you test and see if solves the leak? If does, I will backport.

@cygnusb
Copy link
Author

cygnusb commented Aug 25, 2015

Yes, I will try it out. We suspected the same location already. Thanks!

@cygnusb
Copy link
Author

cygnusb commented Aug 26, 2015

Memory is solved by the patch. Thank you!

@miconda
Copy link
Member

miconda commented Aug 26, 2015

Thanks for reporting back!

@miconda miconda closed this as completed Aug 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants