Can't create timers longer than ~71 minutes
I encountered this issue when setting up the mrt protocol to periodically dump routing tables. Despite specifying "period 28800", which should log every 28,800 seconds = 8 hours, dumps were being saved every 50-ish minutes. It appears this is because timers (defined in lib/timer.h) currently store their interval ("recurrent") in microseconds as a uint - on most platforms, a 32-bit integer. Naturally, 28,800,000,000 µs taken mod 2^32 gives 3,030,196,224 µs, or ~50.5 minutes. As far as I can tell, this means bird's timers (on 32-bit and LP64 platforms) can't wait any longer than 2^32 µs, or ~71.6 minutes. I imagine for many uses this is fine, but for scheduling periodic events, it's not ideal - exporting or syncing some data a handful of times a day (or less!) seems like a sensible thing to want to do. Increasing this to 64 bits seems easy enough - does someone know otherwise? Or have a better idea? Thanks, - Felix
On Wed, Aug 21, 2024 at 07:55:07PM +1000, Felix Friedlander via Bird-users wrote:
I encountered this issue when setting up the mrt protocol to periodically dump routing tables. Despite specifying "period 28800", which should log every 28,800 seconds = 8 hours, dumps were being saved every 50-ish minutes.
It appears this is because timers (defined in lib/timer.h) currently store their interval ("recurrent") in microseconds as a uint - on most platforms, a 32-bit integer. Naturally, 28,800,000,000 µs taken mod 2^32 gives 3,030,196,224 µs, or ~50.5 minutes.
As far as I can tell, this means bird's timers (on 32-bit and LP64 platforms) can't wait any longer than 2^32 µs, or ~71.6 minutes. I imagine for many uses this is fine, but for scheduling periodic events, it's not ideal - exporting or syncing some data a handful of times a day (or less!) seems like a sensible thing to want to do.
Increasing this to 64 bits seems easy enough - does someone know otherwise? Or have a better idea?
Hi You are right. It was okay for most other purposes, but for MRT periods it makes sense to use full 64b range. Fixed: https://gitlab.nic.cz/labs/bird/-/commit/acbdc29d57373a42a512b505c7d4169fd9c... Can you check if that fixes your issue? -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
Felix Friedlander -
Ondrej Zajicek