[OpenSIPS-Devel] Out of pkg mem with own module
Schumann Sebastian
Sebastian.Schumann at t-com.sk
Wed Nov 12 09:33:36 CET 2008
Hi Bogdan
OpenSIPS actually stopped itself by a segfault. Usually, the no more pkg mem appears after some time.
Here the maybe relevant part from the log (all entries with pkg):
Nov 11 22:51:56 [26439] ERROR:core:parse_headers: pkg memory allocation failed
Nov 11 23:02:45 [26439] ERROR:core:parse_headers: pkg memory allocation failed
Nov 11 23:02:45 [26439] ERROR:core:add_lump_rpl: no free pkg memory !
Nov 11 23:02:45 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 368
Nov 11 23:02:46 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 373
Nov 11 23:02:46 [26439] ERROR:core:build_res_b
...
Nov 11 23:07:15 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 441
Nov 11 23:07:16 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 513
Nov 11 23:07:16 [26439] ERROR:pua_script:w_script_publish: no more pkg mem for body (413)
Nov 11 23:07:16 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 513
Nov 11 23:07:16 [26439] ERROR:pua_script:w_script_publish: no more pkg mem for body (413)
Nov 11 23:07:17 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 513
Nov 11 23:07:17 [26439] ERROR:pua_script:w_script_publish: no more pkg mem for body (413)
Nov 11 23:07:19 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 441
Nov 11 23:07:19 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 513
Nov 11 23:07:19 [26439] ERROR:pua_script:w_script_publish: no more pkg mem for body (413)
Nov 11 23:07:23 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 513
Nov 11 23:07:23 [26439] ERROR:pua_script:w_script_publish: no more pkg mem for body (413)
Nov 11 23:07:27 [26439] ERROR:core:build_res_buf_from_sip_res: out of pkg mem
Nov 11 23:07:27 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 380
Nov 11 23:07:27 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 513
Nov 11 23:07:27 [26439] ERROR:pua_script:w_script_publish: no more pkg mem for body (413)
Nov 11 23:07:31 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 513
Nov 11 23:07:31 [26439] ERROR:pua_script:w_script_publish: no more pkg mem for body (413)
Nov 11 23:07:35 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 513
Nov 11 23:07:35 [26439] ERROR:pua_script:w_script_publish: no more pkg mem for body (413)
Nov 11 23:07:39 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 562
Nov 11 23:07:44 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 562
Nov 11 23:07:48 [26439] ERROR:core:add_lump_rpl: no free pkg memory !
Nov 11 23:07:52 [26439] ERROR:core:build_res_buf_from_sip_req: out of pkg memory ; needs 541
Nov 11 23:07:52 [26439] ERROR:presence:send_2XX_reply: No more pkg memoryuf_from_sip_req: out of pkg memory ; needs 368
> -----Original Message-----
> From: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro]
> Sent: Wednesday, 12. November 2008 09:28
> To: Schumann Sebastian
> Cc: devel at lists.opensips.org
> Subject: Re: [OpenSIPS-Devel] Out of pkg mem with own module
>
> 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 ?
Yes.
>
> 2) have you sent the SIGUSR1 to the process reporting "no
> more pkg memeory" or the dump is a shutdown dump?
No, it was caused by a segfault.
>
> 3) are you using default pkg mem value (1M) ?
Yes.
Regards
Sebastian
>
> 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