[ opensips-Bugs-2684950 ] Bug with timers and using get_ticks from a timer thread

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ opensips-Bugs-2684950 ] Bug with timers and using get_ticks from a timer thread

SourceForge.net
Bugs item #2684950, was opened at 2009-03-12 13:49
Message generated for change (Settings changed) made by bogdan_iancu
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=2684950&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: trunk
>Status: Closed
Resolution: Fixed
Priority: 9
Private: No
Submitted By: Vasil Kolev (krokodilerian)
Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
Summary: Bug with timers and using get_ticks from a timer thread

Initial Comment:
There's a nasty issue with the timer code and for example tcp-related functions...

My case was that the timer thread was processing expired registrations and sending notifies for those. Turns out that for some of the registrations which were over TLS the connection was dropped and OpenSIPS tried to establish a new connection to the user, by calling tcpconn_connect_blocking(). That function relies on get_ticks() (e.g. jiffies) to see when it's timed out, but because those ticks are increased in the same thread that called it, it in fact had to wait the default system timeout for connect() (which is about 4 minutes, instead of the 10 seconds OpenSIPS is configured with).

The fix is a bit invasive, but seems like the right way to do it - the jiffies increase is moved in a separate thread and everyone uses that.


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

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2009-03-12 19:49

Message:
patch uploaded (it a slightly modified version). If ok, I will do backport
to 1.4.

Thanks and regards,
Bogdan

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

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2009-03-12 14:01

Message:
Hi Vasil,

Thanks for the report - indeed, the safest fix will be to move the jiffies
into a separate proc to avoid timer blocking and also to increase the timer
accuracy.

Let me review the patch.

Regards,
Bogdan

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

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

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel