[Kamailio-Devel] dialog callback - locks?

Ovidiu Sas osas at voipembedded.com
Tue Sep 23 17:42:16 CEST 2008


Hello Klaus,

I am on the road this days and I will be able to reply with delays ...
see inline.


On Thu, Sep 18, 2008 at 3:15 PM, Klaus Darilion
<klaus.mailinglists at pernau.at> wrote:
>
>
> Ovidiu Sas schrieb:
>>
>> Hello Klaus,
>>
>> During the callbacks (from the dialog module into another module), the
>> dialog is not under a lock and therefore a collision may occur if you
>> access the dialog data and you have more then one child.
>
> What do you mean with "more then one child".

[osas]
Even if you have one single child, you may enter into issues.  One
example is a reINVITE collision.
There will be two transactions that will callback into the same
dialog.  Sorry for misleading you here.

> In pua_dialoginfo module I create the XML body and therefore access the
> dlg_cell structure, e.g. dlg_cell->callid.
>
> What if during the generation of the XML dcoument the dialog gets deleted
> (e.g. BYE request was sent immediately after the INVITE-200-ACK). Would the
> dlg_cell* pointer point to an invalid address  causing segfaults?
>
> So, do I have to lock the dialog list to avoid deletion of the current
> dialog structure? or is the dialog marked as "currently in use" to avoid
> deletion while it is used?

[osas]
I think you will need to lock the dialog if you want to access the
content of the dialog structure during subsequent dialog callbacks.
One option would be to copy all the info that you might need during
the first callback from the dialog context into your module context
and then use then local one.  This will avoid the necessity to lock
the dialog context.  The whole purpose of passing a pointer back to
the dialog module during the initial dialog callback is to create a
link back into the local module context.


> thanks
> klaus
>
>>
>>
>> Regards,
>> Ovidiu Sas
>>
>> On Wed, Sep 17, 2008 at 7:09 AM, Klaus Darilion
>> <klaus.mailinglists at pernau.at> wrote:
>>>
>>> Hi!
>>>
>>> If the dialog callbacks are executed, is it safe to access the elements
>>> in the dialog structure or do I have to obtain any locks before?
>>>
>>> thanks
>>> klaus



More information about the Devel mailing list