[OpenSIPS-Devel] [ opensips-Bugs-3546167 ] TCP/TLS: fix tcp connection lifetime refresh

SourceForge.net noreply at sourceforge.net
Fri Jul 20 03:33:34 CEST 2012


Bugs item #3546167, was opened at 2012-07-19 18:33
Message generated for change (Tracker Item Submitted) made by ditegen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3546167&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: 1.8.x
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Yaroslav M Strilchuk (ditegen)
Assigned to: Nobody/Anonymous (nobody)
Summary: TCP/TLS: fix tcp connection lifetime refresh

Initial Comment:
With declared tcp_persistent_flag in registrar module we expect TCP connection lifetime to be set equal to "expires" parameter in contact on REGISTER message, provided setflag() is called in the routing script before save().

Alas, lifetime value is taken into account only once during the calculation in set_tcp_timeout() (after a connection child is released), then it gets instantly overridden with zero due to a bug in the same function. During each read cycle it will be reassigned with its former value which was once stored in static c_tcp_con_lifetime (in tcp_read.c) as long as static c_tcp_con_id is equal to its connection id. When the next TCP/TLS connection is opened and flagged as persistent, it rewrites both c_tcp_con_lifetime and c_tcp_con_id, so lifetime values of all the previous connections will be zeroed on each cycle. Apparently, we must not share single static variable for all the connections.

This is why the server bluntly cuts sane TCP/TLS connections after inactivity that exceeds tcp_con_lifetime value but still below "expires" threshold! The issue becomes apparent with tcp_con_lifetime set to zero and multiple TCP/TLS connections being flagged with tcp_persistent_flag.

Proposed patch fixes the issue.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3546167&group_id=232389



More information about the Devel mailing list