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

SourceForge.net noreply at sourceforge.net
Tue Aug 7 22:35:18 CEST 2012


Bugs item #3546167, was opened at 2012-07-19 18:33
Message generated for change (Comment added) made by bogdan_iancu
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: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Yaroslav M Strilchuk (ditegen)
>Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
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.


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

>Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2012-08-07 13:35

Message:
Hi Yaroslav,

Many thanks for this report and fix - indeed, the lifetime was wrongly
handled and the effects were not really pleasant :( .

I uploaded your patch on trunk, 1.8 and 1.7.

Best regards,
Bogdan

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

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