Ok, good it was sorted out.
Cheers,
Daniel
On 12.06.19 12:51, Mojtaba wrote:
> I solved it,too.
> All issue was from didn't allocate pkg memory.
> Thank you.
>
> On Wed, Jun 12, 2019 at 11:04 AM Daniel-Constantin Mierla
> <miconda@gmail.com> wrote:
>> What crash with htable api? I can't see anything related in this discussion.
>>
>> On 11.06.19 17:15, Mojtaba wrote:
>>
>> Thank you.
>> And what about the crash when using it with htable api module?
>>
>> On Tue, 11 Jun 2019, 18:18 Daniel-Constantin Mierla <miconda@gmail.com wrote:
>>> 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@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@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@lists.kamailio.org>
>>>>>>> With Best Regards.
>>>>>>>
>>>>>> --
>>>>>> Daniel-Constantin Mierla -- www.asipto.com
>>>>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>>>>>
>>>>> --
>>>>> --Mojtaba Esfandiari.S
>>>> --
>>>> Daniel-Constantin Mierla -- www.asipto.com
>>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>>>
>>> --
>>> Daniel-Constantin Mierla -- www.asipto.com
>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>> --
>> Daniel-Constantin Mierla -- www.asipto.com
>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>
>
--
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda