Giter VIP home page Giter VIP logo

Comments (5)

kamailio-sync avatar kamailio-sync commented on June 14, 2024

from kamailio.

paresh-panda avatar paresh-panda commented on June 14, 2024

Hi Henning,

Thank you for guidance and suggestion. I did change the PKG size to 32MB and increased SHM to 1GB. But the same issue observed with a lesser time duration.

While looking at the below error, found that something changes in the smsops module which was causing the leak

Apr 29 13:28:53 stgn-haud-vm-ub-kamailio01 /usr/sbin/kamailio[5520]: ERROR: {1 1 MESSAGE [email protected]} smsops [smsops_impl.c:815]: decode_3gpp_sms(): Error allocating 192 bytes!

Below is my analysis:
The initial code was

       if (!rp_data) {
		rp_data = (sms_rp_data_t*)pkg_malloc(sizeof(struct _sms_rp_data));
		if (!rp_data) {
			LM_ERR("Error allocating %lu bytes!\n", sizeof(struct _sms_rp_data));
			return -1;
		}
	} else {
		freeRP_DATA(rp_data);
	}

But it got changed in "smsops: Fix conversion from UCS-2 to UTF-8 and viceversa (#3546)" tag 8 months ago

           if(rp_data) {
		freeRP_DATA(rp_data);
	}
	rp_data = (sms_rp_data_t *)pkg_malloc(sizeof(struct _sms_rp_data));
	if(!rp_data) {
		LM_ERR("Error allocating %lu bytes!\n",
				(unsigned long)sizeof(struct _sms_rp_data));
		return -1;
	} 

Now in the recent code it is not reusing the rp_data pointer, rather it allocates every time a new message reaches.

I will try to clone the tag and fix the code and keep you posted

            if(_smsops_rp_data) {
                    freeRP_DATA(_smsops_rp_data);
            } else {  //Added by Paresh Panda

            _smsops_rp_data =
                            (sms_rp_data_t *)pkg_malloc(sizeof(struct _sms_rp_data));
            }

Is there any plan for new tag ? , I am planning to take the latest kamailio tag to production.

I will update you after testing the fix as above.

Thank you!
Regards
Paresh

from kamailio.

henningw avatar henningw commented on June 14, 2024

Hello, thanks for the feedback. Your description sounds indeed like a memory leak. The code logic got changed, so its freeing the rp_data when its allocated now. Its a bit longer function, so it should be properly analyzed that its freed in all error conditions (which does not look like that right now).

from kamailio.

paresh-panda avatar paresh-panda commented on June 14, 2024

Hi Henning,
Thank you for the quick response!

I cloned the code and just changed back the block (which was problematic). Now I see error again as below :

May 1 16:54:43 stgn-haud-vm-ub-kamailio01 /usr/sbin/kamailio[5885]: INFO: <script>: {1 1 MESSAGE [email protected]} Message Outbound MESSAGE sip:[email protected]:5060 (sip:[email protected]:5061 (192.168.136.152:5062) to sip:[email protected]:5060, [email protected])
May 1 16:54:43 stgn-haud-vm-ub-kamailio01 /usr/sbin/kamailio[5875]: INFO: {2 1 MESSAGE [email protected]} <script>: reply route
May 1 16:54:43 stgn-haud-vm-ub-kamailio01 /usr/sbin/kamailio[5875]: ERROR: {2 1 MESSAGE [email protected]} [core/mem/q_malloc.c:324]: qm_find_free(): qm_find_free(0x7f3af4736010, 384); Free fragment not found!
May 1 16:54:43 stgn-haud-vm-ub-kamailio01 /usr/sbin/kamailio[5875]: ERROR: {2 1 MESSAGE [email protected]} [core/mem/q_malloc.c:463]: qm_malloc(): qm_malloc(0x7f3af4736010, 384) called from core: core/msg_translator.c: generate_res_buf_from_sip_res(2435), module: core; Free fragment not found!
May 1 16:54:43 stgn-haud-vm-ub-kamailio01 /usr/sbin/kamailio[5875]: ERROR: {2 1 MESSAGE [email protected]} [core/msg_translator.c:2438]: generate_res_buf_from_sip_res(): could not allocate private memory from pkg pool
May 1 16:54:43 stgn-haud-vm-ub-kamailio01 /usr/sbin/kamailio[5875]: ERROR: {2 1 MESSAGE [email protected]} tm [t_reply.c:2067]: relay_reply(): no mem for outbound reply buffer
May 1 16:54:43 stgn-haud-vm-ub-kamailio01 /usr/sbin/kamailio[5875]: ERROR: {2 1 MESSAGE [email protected]} [core/mem/q_malloc.c:324]: qm_find_free(): qm_find_free(0x7f3af4736010, 416); Free fragment not found!
May 1 16:54:43 stgn-haud-vm-ub-kamailio01 /usr/sbin/kamailio[5875]: ERROR: {2 1 MESSAGE [email protected]} [core/mem/q_malloc.c:463]: qm_malloc(): qm_malloc(0x7f3af4736010, 416) called from core: core/msg_translator.c: build_res_buf_from_sip_req(2608), module: core; Free fragment not found!
May 1 16:54:43 stgn-haud-vm-ub-kamailio01 /usr/sbin/kamailio[5875]: ERROR: {2 1 MESSAGE [email protected]} [core/msg_translator.c:2610]: build_res_buf_from_sip_req(): could not allocate private memory from pkg pool
May 1 16:54:43 stgn-haud-vm-ub-kamailio01 /usr/sbin/kamailio[5875]: ERROR: {2 1 MESSAGE [email protected]} tm [t_reply.c:465]: _reply_light(): response building failed

Does it also look like memory leak this error log appeared and kamailio stopped processing traffic after 35 minutes or so.

When check the pkg memory for the pid as in log

{
entry: 6
pid: 5875
rank: 6
used: 5701888
free: 5728
real_used: 33548704
total_size: 33554432
total_frags: 28
desc: udp receiver child=5 sock=192.168.136.151:5060
}

It shows the udp receiver process PKG Mem is full , I have 8 childrens configured and all started showing the same issue.

Config : PKG 32 MB , SHM 1GB load 1000 msg/sec

Can you please quickly through some lights on this please? Shall I look at it as mem leak or config issue ( may be increase in PKG mem ?

Thank you!

from kamailio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.