Why does my time.Ticker work fine for 6 months then suddenly stop sending ticks?

530 views
Skip to first unread message

Ari Croock

unread,
Nov 26, 2023, 4:59:10 PM11/26/23
to golang-nuts
Hi,

I hope someone here can shed some light on a problem I'm having.


The summary is I have a very simple time.Ticker running with a period of 24h which calls a function that normally only takes a few seconds to run. This worked perfectly fine for about 6 months but then suddenly stopped working (the program has been continuously running for 6 months).

I have attached the debugger so I can see it has paused execution on the `select` statement, waiting for a value on the ticker channel. There doesn't seem to be any way that the ticker.Stop method was called anywhere. If anyone has any suggestions for things to look for in the debugger that would be very welcome.

The binary was built using "go version go1.21.4 linux/amd64".

Thanks

Kevin Chowski

unread,
Nov 26, 2023, 10:24:08 PM11/26/23
to golang-nuts
Perhaps I'm missing something, but given that 1.21.4 was released 2023-11-07 I'm not sure how it could have been running for 6 months. Do you mind double-checking your assumptions?

Ari Croock

unread,
Nov 27, 2023, 2:38:52 AM11/27/23
to golang-nuts
Sorry for the confusion, I must have updated go since I built this binary.
If I run `go version <binary file>` I get "go1.20.4" (released 2023-05-02) which sounds about right.

Eric Hubbard

unread,
Nov 27, 2023, 11:38:42 AM11/27/23
to Ari Croock, golang-nuts
Do all ticker stop? or just the one?

I had a problem back in 1.17? where the clock that powered the tickers wasn't monotomic ..   only on some systems and configurations..  



--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/c006f5e5-2484-4ebd-87ab-f254760fe200n%40googlegroups.com.

Bryan C. Mills

unread,
Nov 27, 2023, 6:09:20 PM11/27/23
to golang-nuts
Given the number of known overflows present in the `time` package (https://go.dev/issue/20678, https://go.dev/issue/56909), I wouldn't be terribly surprised to find one in Ticker as well, although 6 months seems awfully short to hit an overflow bug.

Consider filing an issue at https://go.dev/issue/new. (Perhaps the runtime team can give you some advice there on how to collect a core dump for inspection?)

On Sunday, November 26, 2023 at 4:59:10 PM UTC-5 Ari Croock wrote:

Jason E. Aten

unread,
Dec 2, 2023, 9:41:43 PM12/2/23
to golang-nuts
As a workaround, it is a pretty common idiom to re-create timers (or in this case, Tickers) after each firing.
Reply all
Reply to author
Forward
0 new messages