[OpenSER-Devel] need advice for avp lock

Di-Shi Sun di-shi at transnexus.com
Fri Oct 26 05:11:21 CEST 2007


Hi Bogdan,

We use TMCB_ON_FAILURE, TMCB_RESPONSE_OUT, TMCB_E2EACK and
TMCB_ON_FAILURE_RO.

In our call scenario, the callback function was triggered by
TMCB_RESPONSE_OUT twice and TMCB_E2EACK once. We believe the twice
TMCB_RESPONSE_OUTs caused the race condition. Since sometimes we saw
"t->uac[t->first_branch].last_received" in the callback function were 180
and 200 (sometime two 200s), we think the call back was triggered by 180 and
200.

Would you please tell me is FAST_LOCK cam be used for AVP values?

Thanks,

Di-Shi Sun.

----- Original Message ----- 
From: "Bogdan-Andrei Iancu" <bogdan at voice-system.ro>
To: "Di-Shi Sun" <di-shi at transnexus.com>
Cc: "Support TransNexus" <support at transnexus.com>
Sent: Friday, October 26, 2007 12:38 AM
Subject: Re: [OpenSER-Devel] need advice for avp lock


> Hi Di-Shi,
>
> TM allows the following callbacks:
>
> #define TMCB_REQUEST_IN         (1<<0)
> #define TMCB_RESPONSE_IN        (1<<1)
> #define TMCB_E2EACK_IN          (1<<2)
> #define TMCB_REQUEST_FWDED      (1<<3)
> #define TMCB_RESPONSE_FWDED     (1<<4)
> #define TMCB_ON_FAILURE_RO      (1<<5)
> #define TMCB_ON_FAILURE         (1<<6)
> #define TMCB_RESPONSE_OUT       (1<<7)
> #define TMCB_LOCAL_COMPLETED    (1<<8)
> #define TMCB_LOCAL_RESPONSE_OUT (1<<9)
> #define TMCB_REQUEST_BUILT      (1<<10)
> #define TMCB_TRANS_DELETED      (1<<11)
>
> Which one are you referring in this case?
>
> Regards,
> Bogdan
>
> Di-Shi Sun wrote:
> > Hi Bogdan,
> >
> > Would you please tell me what kind types of tm callback you refer to?
> >
> > Thanks,
> >
> > Di-Shi Sun.
> >
> > ----- Original Message ----- 
> > From: "Bogdan-Andrei Iancu" <bogdan at voice-system.ro>
> > To: "Di-Shi Sun" <di-shi at transnexus.com>
> > Cc: "Support of TransNexus" <support at transnexus.com>;
<devel at openser.org>
> > Sent: Thursday, October 25, 2007 12:00 AM
> > Subject: Re: [OpenSER-Devel] need advice for avp lock
> >
> >
> >
> >> Hi Di-Shi,
> >>
> >> But what type of TM callback are you using?
> >>
> >> Di-Shi Sun wrote:
> >>
> >>> Hi Bogdan,
> >>>
> >>> We use tm callback function ospTmcbFunc defined in module/osp/tm.c. It
> >>>
> > reads
> >
> >>> a set of AVPs and creates some OSP internal data structures. Then
starts
> >>> another thread to connect the OSP server. It worked fine except the
race
> >>> condition. Do you recommend do it in onreply route block?
> >>>
> >>> Thanks,
> >>>
> >>> Di-Shi Sun.
> >>>
> >>> ----- Original Message ----- 
> >>> From: "Bogdan-Andrei Iancu" <bogdan at voice-system.ro>
> >>> To: "Di-Shi Sun" <di-shi at transnexus.com>
> >>> Cc: "Henning Westerholt" <henning.westerholt at 1und1.de>;
> >>>
> > <devel at openser.org>;
> >
> >>> "Support of TransNexus" <support at transnexus.com>
> >>> Sent: Tuesday, October 23, 2007 10:51 PM
> >>> Subject: Re: [OpenSER-Devel] need advice for avp lock
> >>>
> >>>
> >>>
> >>>
> >>>> Hi Di-Shi,
> >>>>
> >>>> So you access this info from a callback and not from onreply
> >>>> route...What callback it is?
> >>>>
> >>>> Regards,
> >>>> Bogdan
> >>>>
> >>>> Di-Shi Sun wrote:
> >>>>
> >>>>
> >>>>> Hi Henning,
> >>>>>
> >>>>> Our case is like this:
> >>>>> 1. Our tm call back function was triggered by out 180 and 200. The
> >>>>>
> >>>>>
> >>> interval
> >>>
> >>>
> >>>>> between 180 and 200 was so short.
> >>>>> 2. The call back function accessed a set of AVPs and set a flag (in
> >>>>>
> > AVP
> >
> >>>>> value) for every AVP to mark these AVPs were comsumed. This flag
made
> >>>>>
> >>>>>
> >>> these
> >>>
> >>>
> >>>>> AVPs to be used only once. Since the call back function was called
> >>>>>
> > twice
> >
> >>> at
> >>>
> >>>
> >>>>> almost the same time, the race condition happned that some AVPs were
> >>>>>
> >>>>>
> >>> used
> >>>
> >>>
> >>>>> twice.
> >>>>>
> >>>>> According the source code, we believe that USE_PTHREAD_MUTEX lock
set
> >>>>>
> > is
> >
> >>>>> thread safe and can be used for AVP. But the default lock set is
> >>>>>
> >>>>>
> >>> FAST_LOCK.
> >>>
> >>>
> >>>>> We do not know if it can be used for AVP.
> >>>>>
> >>>>> Regards,
> >>>>>
> >>>>> Di-Shi Sun.
> >>>>>
> >>>>> ----- Original Message ----- 
> >>>>> From: "Henning Westerholt" <henning.westerholt at 1und1.de>
> >>>>> To: "Di-Shi Sun" <di-shi at transnexus.com>
> >>>>> Cc: <devel at openser.org>; "Support of TransNexus"
> >>>>>
> >>>>>
> >>> <support at transnexus.com>
> >>>
> >>>
> >>>>> Sent: Tuesday, October 23, 2007 9:35 PM
> >>>>> Subject: Re: [OpenSER-Devel] need advice for avp lock
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>> On Thursday 18 October 2007, Di-Shi Sun wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> Hi Henning,
> >>>>>>>
> >>>>>>> I believe we met the same problem. For us, only one flag in an AVP
> >>>>>>>
> > (5
> >
> >>>>>>>
> >>>>> AVPs
> >>>>>
> >>>>>
> >>>>>
> >>>>>>> for a call) is set and the logic is simple. So, we did not meet a
> >>>>>>>
> >>>>>>>
> >>> crash
> >>>
> >>>
> >>>>>>> condition. It happened 17 times in a 1M call test at 50 cps.
> >>>>>>>
> >>>>>>> Klaus Darilion suggested we read the tm code for the AVP lock. I
> >>>>>>>
> > will
> >
> >>>>>>>
> >>>>> study
> >>>>>
> >>>>>
> >>>>>
> >>>>>>> it.
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>> I've studied this code too, but i found nothing helpful. What kind
of
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>> error
> >>>>>
> >>>>>
> >>>>>
> >>>>>> you've observed? In your first mail you spoke about a race
condition,
> >>>>>>
> >>>>>>
> >>> is
> >>>
> >>>
> >>>>> the
> >>>>>
> >>>>>
> >>>>>
> >>>>>> wrong AVP value accessed?
> >>>>>>
> >>>>>> Cheers,
> >>>>>>
> >>>>>> Henning
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>> _______________________________________________
> >>>>> Devel mailing list
> >>>>> Devel at openser.org
> >>>>> http://openser.org/cgi-bin/mailman/listinfo/devel
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
> >
> >
>
>
>





More information about the Devel mailing list