R: R: [Serusers] Retransmission problem
Zappasodi Daniele
dzappasodi at seltatel.it
Thu Sep 21 15:09:11 CEST 2006
Hello,
In the past days I have done some tests: I have removed the t_newtran and t_forward_nonackuri (now I use only t_relay) and I have put the proxy on a different address, but the problem persists.
Looking better the syslog I have observed that the retransmission occurs when happens this situation:
a child process handles the INVITE, forwards it, but after it sends out the UDP message, the OS gives the execution control to other children, so it can't complete the execution and in particular it can't set the retransmission timer (start_retr in t_forward_non_ack).
Sep 13 10:14:32 SAM-IP ser[870]: DEBUG: _reply_light: finished
Sep 13 10:14:32 SAM-IP ser[870]: DEBUG: mk_proxy: doing DNS lookup...
Sep 13 10:14:32 SAM-IP ser[870]: check_via_address(10.1.9.170, 10.1.9.170, 0)
...
Now are in execution the other children, while the it remains suspended. When the OS gives again the control to the first "INVITE child" it completes the execution (with start_retr and so on), but sometimes takes it too late, after the arrive of a final reply (480 Temporarily Unavailible):
Sep 13 10:14:33 SAM-IP ser[870]: DEBUG: add_to_tail_of_timer[4]: 0x405e3c80
Sep 13 10:14:33 SAM-IP ser[870]: DEBUG: add_to_tail_of_timer[0]: 0x405e3c90
Sep 13 10:14:33 SAM-IP ser[870]: SER: new transaction fwd'ed
Sep 13 10:14:33 SAM-IP ser[870]: DEBUG:destroy_avp_list: destroying list (nil)
Sep 13 10:14:33 SAM-IP ser[870]: receive_msg: cleaning up
In this case, immediately after it set the retransmission timeout, the timer process starts the retrasmission of the original INVITE, without waiting the timeout value (1 second) and moreover without taking care of the fact that the transaction is deleted:
Sep 13 10:14:33 SAM-IP ser[879]: DEBUG: timer routine:0,tl=0x405e3c24 next=(nil)
Sep 13 10:14:33 SAM-IP ser[879]: DEBUG: timer routine:4,tl=0x405e3c14 next=0x405ea470
Sep 13 10:14:33 SAM-IP ser[879]: DEBUG: timer routine:4,tl=0x405ea470 next=0x405e3c80
Sep 13 10:14:33 SAM-IP ser[879]: DEBUG: retransmission_handler : request resending (t=0x405ea358, INVITE si ... )
Sep 13 10:14:33 SAM-IP ser[879]: DEBUG: add_to_tail_of_timer[5]: 0x405ea470
Sep 13 10:14:33 SAM-IP ser[879]: DEBUG: retransmission_handler : done
Sep 13 10:14:33 SAM-IP ser[879]: DEBUG: timer routine:4,tl=0x405e3c80 next=(nil)
Sep 13 10:14:33 SAM-IP ser[879]: DEBUG: retransmission_handler : request resending (t=0x405e3b68, INVITE si ... )
Sep 13 10:14:33 SAM-IP ser[879]: DEBUG: add_to_tail_of_timer[5]: 0x405e3c80
Sep 13 10:14:33 SAM-IP ser[879]: DEBUG: retransmission_handler : done
I suppose that the inconsistency is related to the setting of the timer after the "480", probably in the handling of the final reply there is the cleaning of the retransmission timer, but in this race condition the timer is set after the 480.
I'm not familiar with the internal code of the tm and timer modules, but what do you think if I change the position of the instructions in the t_forward_non_ack function in order to set the timer before sending out the UDP packet?
start_retr( &t->uac[i].request );
if (added_branches & (1<<i)) {
if (SEND_BUFFER( &t->uac[i].request)==-1) {
LOG(L_ERR, "ERROR: t_forward_nonack: sending request failed\n");
if (proxy) { proxy->errors++; proxy->ok=0; }
} else {
success_branch++;
}
I hope in this way, the handling of the final reply cleans correctly the timer.
Otherwise I would put some test before the start_retr function to understand if the transaction is still alive.
Regards,
Daniele.
-----Messaggio originale-----
Da: Greger V. Teigre [mailto:greger at teigre.com]
Inviato: giovedì 7 settembre 2006 9.24
A: Zappasodi Daniele
Cc: serusers at lists.iptel.org
Oggetto: Re: R: [Serusers] Retransmission problem
Inline.
Zappasodi Daniele wrote:
Many thanks for the reply, it is very useful but it contains bad news because, if is it possible, it is important for me to preserve the possibility to have the SIP proxy and SIP gateway in the same board.
Some other clarification:
1. I have two ethernet interfaces, if I give different IP address to proxy and gateway, can I leave them on the same hardware?
Yes, the trick is to get the listen and alias directives correct in your ser.cfg. You can run multiple servers or UAs on the same server, you just have to make sure you don't have alias=myip in ser.cfg. This will make SER believe messages for another server/UA is to be routed locally.
2. If I correctly understand the transaction creation in SER: SER absorbs the retransmission only if already exists a transaction for the original INVITE and SER creates a new transaction for an INVITE only when is invoked the t_relay.
Yes, if not, SER will be transaction stateless and just happily forward any message.
Consequently, If a retransmitted INVITE arrives when the elaboration of the original INVITE is still in progress, SER repeats all the elaboration also for the second INVITE.
I'm not sure what you mean by "elaboration", but if you mean that the script will be executed for retransmitted INVITEs, then yes.
Do you confirm my description?
I have built a function that in heavy load traffic condition could be slow (it does an external query, something similar to an exec) and it is important that I don't invoke it twice for the same INVITE, so I try to use t_newtran to anticipate the transaction creation before invoking this function.
However, as first step, I will remove the t_newtran, t_forward_nonack_uri and I try again.
Normally, you should not have to worry about the transaction state, just process the INVITE and use t_relay() and let SER handle the retransmissions etc. I cannot see that your scenario would require more fine-grained control over the transaction state, but then I don't know what you are trying to do...
g-)
Thanks again.
-----Messaggio originale-----
Da: Greger V. Teigre [mailto:greger at teigre.com]
Inviato: mercoledì 6 settembre 2006 9.19
A: Zappasodi Daniele
Cc: serusers at lists.iptel.org
Oggetto: Re: [Serusers] Retransmission problem
1. DON'T have UA2 and SER on the same server. You are very likely to get problems because SER sees it's own IP address in a message destined for UA2
2. Don't use t_newtran and t_forward_nonack_uri unless you know exactly what you do (and probably not then either)
3. When having problems like that, use a pretested Getting Started config fil (http://iptel.org/ser/doc/gettingstarted). If you still have the problem, there is something external (like UA2 on same box as SER). Fix it and then compare the logic of your config file with the Getting Started reference config
g-)
Zappasodi Daniele wrote:
Hello,
I have a big problem with the retransmissions.
In my tests sometimes the retransmission handler doesn't seem to work properly and it resends the INVITE after receiving a final response.
Moreover it doesn't respect the time-out (instead wait 1 second it resends the packet after few decimal), but this is a minor item.
An example:
INVITE sip:31203
From 32201
UA1(32201) ---> SER ---> UA2(31203)
INVITE UA1 ---> SER ---> UA2
Trying UA1 <--- SER
183 UA1 <--- SER <--- UA2
480 UA1 <--- SER <--- UA2
ACK UA1 ---> SER ---> UA2
...
Other call.
After 0,5 msec SER sends again the first INVITE to UA2:
INVITE SER ---> UA2
183 SER <--- UA2
etc.
In the attached zipped file there are the syslog, the ser config file (only the relevant parts) and the ethereal captures related to this example.
Some additional information:
SER version is 0.9.2, compiled for arm.
In my scenario SER and UA2 are on the same box.
In LAN_capture.cap file there is the message flow between UA1 and SER, in lo_capture.cap between SER and UA2.
Can someone explain me this behaviour?
Maybe something wrong in my config file? Note that I use t_lookup_request, t_newtran, t_forward_nonack_uri in order to recognize retransmitted INVITE, could it be here the problem?
thanks
**********************************************************************
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.
**********************************************************************
_______________________________________________
Serusers mailing list
Serusers at lists.iptel.org
http://lists.iptel.org/mailman/listinfo/serusers
**********************************************************************
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.
**********************************************************************
**********************************************************************
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.
**********************************************************************
More information about the sr-users
mailing list