[OpenSIPS-Devel] Out of pkg mem with own module
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Wed Nov 12 09:28:13 CET 2008
Hi Sebastian,
The dump does not show any leak, so here are some questions:
1) have you waited for a "no more pkg memeory" from a process ?
2) have you sent the SIGUSR1 to the process reporting "no more pkg
memeory" or the dump is a shutdown dump?
3) are you using default pkg mem value (1M) ?
Regards,
Bogdan
Schumann Sebastian wrote:
> Hi Bogdan,
>
> thanks for the hint.
>
> I did this first time, so I would kindly ask for some help here. I posted the end of the log here: http://pastebin.com/fe92b61b I didn't get anything out of this information :-(
>
> This time, also a seg fault occured, I have a core dump as well. I don't know how to debug it in particular, if this is helpful as well please let me know.
>
> Best regards
> Sebastian
>
>
>> -----Original Message-----
>> From: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro]
>> Sent: Tuesday, 11. November 2008 10:29
>> To: Schumann Sebastian
>> Cc: devel at lists.opensips.org
>> Subject: Re: [OpenSIPS-Devel] Out of pkg mem with own module
>>
>> Hi Sebastian,
>>
>> Rule number one when comes to debuging - first identify the
>> cause and then fix it :)..So, you should be 100% you
>> identified the leak source
>>
>> Regards,
>> Bogdan
>>
>>
>> Schumann Sebastian wrote:
>>
>>> Hi Bogdan
>>>
>>> I am not sure, but I figured the problem must come from my
>>>
>> module. And I have only two times where I use pkg_malloc and
>> both look like the snip.
>>
>>> I will try to debug it, let's see if I will be successful.
>>>
>> Thanks for this direction.
>>
>>> Sebastian
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro]
>>>> Sent: Monday, 10. November 2008 17:52
>>>> To: Schumann Sebastian
>>>> Cc: devel at lists.opensips.org
>>>> Subject: Re: [OpenSIPS-Devel] Out of pkg mem with own module
>>>>
>>>> Hi Sebastian,
>>>>
>>>> The snip looks ok - are you sure the leak comes from here?
>>>> have you tried to use the memory debuger to identify the source -
>>>> http://www.opensips.org/index.php?n=Resources.DocsTsMem
>>>>
>>>> Regards,
>>>> Bogdan
>>>>
>>>> Schumann Sebastian wrote:
>>>>
>>>>
>>>>> Hi all
>>>>>
>>>>> I have written a module and after running the proxy for
>>>>>
>> quite some
>>
>>>>> time I get out of pkg mem message.
>>>>>
>>>>> I attached a piece of code how I deal with pkg mem. Please
>>>>>
>>>>>
>>>> let me know
>>>>
>>>>
>>>>> if there is something wrong or forgotten respectively.
>>>>>
>>>>> Thanks a lot.
>>>>> Sebastian
>>>>>
>>>>> [snip]
>>>>> n = body_start.len + pres_uri.len + body_middle.len +
>>>>>
>>>>>
>>>> TUPLE_ID_SIZE +
>>>>
>>>>
>>>>> body_end.len; s = (char *)pkg_malloc(n); /* as pointers are
>>>>>
>>>>>
>>>> used must
>>>>
>>>>
>>>>> not be freed after last use of any reference */
>>>>> if(s==NULL) {
>>>>> LM_ERR("no more pkg mem for body (%d)\n", n);
>>>>> return -1;
>>>>> }
>>>>> p=s;
>>>>> memcpy(p, body_start.s, body_start.len); p += body_start.len;
>>>>> memcpy(p, pres_uri.s, pres_uri.len); p += pres_uri.len; memcpy(p,
>>>>> body_middle.s, body_middle.len); p += body_middle.len; int i;
>>>>> for(i=0;i<TUPLE_ID_SIZE;i++) {
>>>>> *(p++) = tuple[i];
>>>>> }
>>>>>
>>>>> memcpy(p, body_end.s, body_end.len); p += body_end.len;
>>>>>
>> body.s = s;
>>
>>>>> body.len = (int)(p-s);
>>>>>
>>>>> if(body.len > n) {
>>>>> LM_ERR("Buffer size overflow for body\n");
>>>>> pkg_free(s);
>>>>> return -1;
>>>>> }
>>>>> ...
>>>>> pkg_free(s);
>>>>> [snip]
>>>>>
>>>>>
>>>>>
>> ---------------------------------------------------------------------
>>
>>>> -
>>>>
>>>>
>>>>> --
>>>>>
>>>>> _______________________________________________
>>>>> Devel mailing list
>>>>> Devel at lists.opensips.org
>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>
>
More information about the Devel
mailing list