[Devel] tcp keepalive question

Dan Pascu dan at ag-projects.com
Mon Dec 18 23:17:44 CET 2006


On Monday 18 December 2006 18:09, Juha Heinanen wrote:
> if there is no way to detect that tcp session does not exist before
> sending crlfcrlf to SIP UA, then this indeed may lead to problems.

I know of none. The other endpoint may have been cut off the network right 
before you want to sent to it so no session closing indication was 
received. When you send it'll timeout but the timeout delay is too long 
for realtime handling, unless you have an architecture based around an 
event driven approach and you can process other things in parallel 
without blocking.

This issue affects more than just the keepalive process. Even if the 
kernel handles the keepalive at the OS level by sending TCP KEEPALIVES, 
so presumably OpenSER knows at all times that the connection should be 
up, this means nothing in the end. Exactly as said above, the other 
endpoint may be cut of the network and have no chance to signal its 
leave. Until the kernel will start the keepalive procedure and finish it 
by declaring the other endpoint dead and closing the connection, any 
attempt to send a message to the other endpoint will result in a long 
wait before timing out.

When you combine this fact with the blocking nature of OpenSER, it can 
raise serious issues when many TCP clients are connected and there is a 
high churn rate among them combined with high SIP traffic.

-- 
Dan



More information about the Devel mailing list