[Kamailio-Devel] race condition

Daniel-Constantin Mierla miconda at gmail.com
Thu Apr 23 10:55:32 CEST 2009


Hello Daniele,

thanks for the patch. The later version has some improvements in 
narrowing the time frame for this race, there was long thread of 
discussion on this list. Yours does the same, so worth to commit. I will 
take care.

Cheers,
Daniel

On 04/23/2009 10:34 AM, Zappasodi Daniele wrote:
> Hello,
> I have a problem with a race condition with the reply and retransmission.
> Sometimes Openser (I'm still working with 1.3.x version) ignores the provisional reply and tears down the call after the fr_timer.
> This happens only in a particulary conditions: 
> I have a short value for fr_timer (5 sec);
> the reply arrives very fast (I have gateway and proxy on the same box).
>
> In this situation can happen that a child sends the INVITE (SEND_BUFFER in t_forward_nonack) and it is suspended by the scheduler before it can execute start_retr. 
> Another child get the reply.
> When the first child executes start_retr it sends immediately a retransmission for the INVITE and after 5 seconds (the fr_timer) it tears down the call with CANCEL, because it ignores the reply.
>
> I know that this is a very improbable condition (even if I encountered it), but if you want to fix it, it should be easy to solve: in t_forward_nonack, before start_retr, it should be tested if another child has already received a reply. 
> Something like this (t_fwd.c on head):
>
> @@ -719,7 +719,10 @@
>                                         -p_msg->REQ_METHOD);
>                         }
>   
> -                       start_retr( &t->uac[i].request );
> +                       if(p_msg->REQ_METHOD==METHOD_INVITE && t->uac[i].last_received>=100)
> +                               LM_DBG("Last received %d\n",t->uac[i].last_received);
> +                       else
> +                               start_retr( &t->uac[i].request );
>                         set_kr(REQ_FWDED);
>                 }
>         }
>
> **********************************************************************
> The information in this message is confidential and may be legally
> privileged. It is intended solely for the addressee. Access to this 
> message
> by anyone else is unauthorized. If you are not the intended 
> recipient, any
> disclosure, copying, or distribution of the message, or any action 
> or
> omission taken by you in reliance on it, is prohibited and may be 
> unlawful.
> Please immediately contact the sender if you have received this 
> message in error.
>
>
> **********************************************************************
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Kamailio (OpenSER) - Devel mailing list
> Devel at lists.kamailio.org
> http://lists.kamailio.org/cgi-bin/mailman/listinfo/devel
> http://lists.openser-project.org/cgi-bin/mailman/listinfo/devel

-- 
Daniel-Constantin Mierla
http://www.asipto.com/




More information about the Devel mailing list