<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>R: [OpenSER-Users] Error with parallel forking and TCP</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>

<P><FONT SIZE=2>Hello,<BR>
I have investigated a bit.<BR>
The problem seems to be related to t_pick_branch.<BR>
In the case described it returns -2 because it found a branch still unfinished (last_received&lt;200) for the branch that has lost the TCP connection.<BR>
I think that a first step could be assigning a value &gt; 200 to last_received for the branches that fail to send out the INVITE.<BR>
In t_forward_nonack<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (SEND_BUFFER( &amp;t-&gt;uac[i].request)==0) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nb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;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>
<BR>
<BR>
I have added here something like this<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(ser_error==E_SEND)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t-&gt;uac[i].last_received=700;&nbsp;&nbsp;&nbsp; // 700 ???&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
<BR>
and now parallel forking works.<BR>
I don't know if it is enough, but what do yuo think about this small change? could it be dangerous in other circumstances?<BR>
<BR>
<BR>
-----Messaggio originale-----<BR>
Da: Klaus Darilion [<A HREF="mailto:klaus.mailinglists@pernau.at">mailto:klaus.mailinglists@pernau.at</A>]<BR>
Inviato: ven 25/07/2008 12.35<BR>
A: Zappasodi Daniele<BR>
Cc: users@lists.openser.org<BR>
Oggetto: Re: [OpenSER-Users] Error with parallel forking and TCP<BR>
<BR>
<BR>
<BR>
Zappasodi Daniele schrieb:<BR>
&gt; Hello,<BR>
&gt; I have a problem with parallel forking and TCP when one connection isn't<BR>
&gt; available and the inv_timeout expires.<BR>
&gt; I have two clients registered with the same username and transport=TCP.<BR>
&gt; If I make a call to this number when one of them is not reachable, the<BR>
&gt; INVITE goes to the phone reachable, if the call timeout expires<BR>
&gt; (fr_inv_timer_avp) Openser sends the CANCEL, but doesn't send anything<BR>
&gt; to the caller.<BR>
&gt; The failure_route doesn't hit.<BR>
<BR>
Looks like a bug.<BR>
&gt;<BR>
&gt; There is also a delay between the t_relay and the forwarding of the<BR>
&gt; packet TCP on the net (around 3 seconds). The TCP packet is forwarded to<BR>
&gt; the available connection only after Openser detects the failure for the<BR>
&gt; closed TCP connection (the INVITE goes on the net only after the message<BR>
&gt; ERROR:tm:t_forward_nonack: sending request failed).<BR>
<BR>
I suspect the problem is synchronous blocking TCP operation. Openser<BR>
tries to send to first contact, then to second contact. As sending to<BR>
first contact fails (probably with a TCP timeout of 3 seconds - check<BR>
core book documentation for setting TCP timeouts) it takes 3 seconds<BR>
until it sends the request on the second connection.<BR>
<BR>
regards<BR>
klaus<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML><pre>**********************************************************************
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 inerror.

**********************************************************************</pre>