[SR-Users] CRITICAL ERROR in data_lamp.c!

Daniel-Constantin Mierla miconda at gmail.com
Tue Jun 11 15:48:43 CEST 2019


Yes, you must allocate with pkg, because at the end those chunks are
freed, once the new message is built. You can also look at how other
operations with data lumps are done inside the textops module.

On 11.06.19 14:44, Mojtaba wrote:
> I assigned a const sdp string to it just for checking. Does it matter
> to allocate new memory for newbody?
>
> On Tue, 11 Jun 2019, 15:22 Daniel-Constantin Mierla <miconda at gmail.com
> <mailto:miconda at gmail.com> wrote:
>
>     Hello,
>
>     how do you set newbody.s and newbody.len?
>
>     Daniel
>
>     On 11.06.19 12:29, Mojtaba wrote:
>     > Not yet, because it is under developing, i could paste it here
>     right away.
>     >
>     > {
>     >  .
>     >  .
>     >  .
>     >     body.s = get_body(msg);
>     >     if (body.s == 0) {
>     >                 LM_ERR("failed to get the message body\n");
>     >         return -1;
>     >     }
>     >     body.len = msg->len - (int) (body.s - msg->buf);
>     > //    body.len = strlen(body.s);
>     >     if (body.len == 0) {
>     >                 LM_DBG("message body has zero length\n");
>     >         return -1;
>     >     }
>     >     l = del_lump(msg, body.s - msg->buf, body.len, 0);
>     >     if (!l) {
>     >                 LM_ERR("del_lump failed\n");
>     >         return -1;
>     >     }
>     >
>     >     if (!insert_new_lump_after(l, newbody.s, newbody.len, 0)) {
>     >                 LM_ERR("insert_new_lump_after failed\n");
>     >         return -1;
>     >     }
>     > }
>     > I asked related issue in this regards in Kamailio developer forum,
>     > before. let me paste it at below. The means of other_process
>     function
>     > is above code.
>     > In during developing new module in Kamailio, I encountered with
>     > strange behaviour. I used htable module instead of linked list for
>     > save some temporary data during call process.dependencies module to
>     > save some information. the skeleton of my code is like thus:
>     >
>     > if (SIP_REQUEST &METHOD_INVITE) {
>     >           insert_data_htable("some data");
>     >           other_process(msg);
>     > }else if(SIP_REPLY){
>     >          get_data_htable("some data");
>     >          other_process(msg);
>     > }
>     > In other_process function i have some changes in msg's body with
>     message lump.
>     > But after i make first call in kamailio. The kamailio was
>     crashed.What
>     > is it's problem?
>     > In additional if i comment either insert/get_data_htable function or
>     > othet_process function, i dont have this issue.
>     > With best regards.
>     >
>     >
>     > On Tue, Jun 11, 2019 at 2:46 PM Daniel-Constantin Mierla
>     > <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>     >> Hello,
>     >>
>     >> likely you didn't allocate the pointer inserted in data lump
>     list. Is
>     >> the code using data lumps available to look at on git?
>     >>
>     >> Cheers,
>     >> Daniel
>     >>
>     >> On 11.06.19 12:01, Mojtaba wrote:
>     >>> Hello,
>     >>> What does this CRITICAL error mean?
>     >>> Jun 11 05:48:13 debian8 /usr/local/sbin/kamailio[8468]: {1 1
>     INVITE
>     >>> Njg0MzNhMzJhOTY3MzQ3NmNlNWY0ODkzMTJmNTM1ZTk.} CRITICAL: <core>
>     >>> [core/mem/q_malloc.c:486]: qm_free(): BUG: bad pointer
>     0xa3c188 (out
>     >>> of memory block!) called from core: core/data_lump.c:
>     free_lump(466) -
>     >>> aborting
>     >>>
>     >>> I got it when i make new call during debugging new module in
>     Kamailio?
>     >>> In module we have to change some message's body with data_lump.
>     >>> I asked relaed issue (strange behaviour while developing new
>     module)
>     >>> in Kamailio developer forum <sr-dev at lists.kamailio.org
>     <mailto:sr-dev at lists.kamailio.org>>
>     >>> With Best Regards.
>     >>>
>     >> --
>     >> Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com>
>     >> www.twitter.com/miconda <http://www.twitter.com/miconda> --
>     www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda>
>     >>
>     >
>     > --
>     > --Mojtaba Esfandiari.S
>
>     -- 
>     Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com>
>     www.twitter.com/miconda <http://www.twitter.com/miconda> --
>     www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda>
>
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190611/445aaeb7/attachment.html>


More information about the sr-users mailing list