A proc "gnome-clock" eating up CPU cycles and battery

While looking for something else, I found a process, started on every boot and doing something in a cycle with one second, i.e. it wakes up every second from poll. See below. For what is this heavy drain good for:

ps ax | grep clock
   1251 tty7     Sl+    2:00 gnome-clocks --hidden
   9652 pts/0    S+     0:00 grep clock

strace -t -p 1251
strace: Process 1251 attached
10:38:10 ppoll([{fd=4, events=POLLIN}, {fd=8, events=POLLIN}, {fd=11, events=POLLIN}, {fd=16, events=POLLIN}], 4, NULL, NULL, 0) = 1 ([{fd=4, revents=POLLIN}])
10:38:10 read(4, "\1\0\0\0\0\0\0\0", 16) = 8
10:38:10 ppoll([{fd=4, events=POLLIN}, {fd=8, events=POLLIN}, {fd=11, events=POLLIN}, {fd=16, events=POLLIN}], 4, NULL, NULL, 0) = 1 ([{fd=16, revents=POLLIN}])
10:38:11 write(4, "\1\0\0\0\0\0\0\0", 8) = 8
10:38:11 timerfd_create(CLOCK_REALTIME, TFD_CLOEXEC) = 15
10:38:11 timerfd_settime(15, TFD_TIMER_ABSTIME|TFD_TIMER_CANCEL_ON_SET, {it_interval={tv_sec=0, tv_nsec=0}, it_value={tv_sec=1742722692, tv_nsec=0}}, NULL) = 0
10:38:11 write(4, "\1\0\0\0\0\0\0\0", 8) = 8
10:38:11 close(16)                      = 0
10:38:11 ppoll([{fd=4, events=POLLIN}, {fd=8, events=POLLIN}, {fd=11, events=POLLIN}, {fd=15, events=POLLIN}], 4, NULL, NULL, 0) = 1 ([{fd=4, revents=POLLIN}])
10:38:11 read(4, "\2\0\0\0\0\0\0\0", 16) = 8
10:38:11 ppoll([{fd=4, events=POLLIN}, {fd=8, events=POLLIN}, {fd=11, events=POLLIN}, {fd=15, events=POLLIN}], 4, NULL, NULL, 0) = 1 ([{fd=15, revents=POLLIN}])
10:38:12 write(4, "\1\0\0\0\0\0\0\0", 8) = 8
10:38:12 timerfd_create(CLOCK_REALTIME, TFD_CLOEXEC) = 16
10:38:12 timerfd_settime(16, TFD_TIMER_ABSTIME|TFD_TIMER_CANCEL_ON_SET, {it_interval={tv_sec=0, tv_nsec=0}, it_value={tv_sec=1742722693, tv_nsec=0}}, NULL) = 0
10:38:12 write(4, "\1\0\0\0\0\0\0\0", 8) = 8
10:38:12 close(15)                      = 0
10:38:12 ppoll([{fd=4, events=POLLIN}, {fd=8, events=POLLIN}, {fd=11, events=POLLIN}, {fd=16, events=POLLIN}], 4, NULL, NULL, 0) = 1 ([{fd=4, revents=POLLIN}])
10:38:12 read(4, "\2\0\0\0\0\0\0\0", 16) = 8
10:38:12 ppoll([{fd=4, events=POLLIN}, {fd=8, events=POLLIN}, {fd=11, events=POLLIN}, {fd=16, events=POLLIN}], 4, NULL, NULL, 0) = 1 ([{fd=16, revents=POLLIN}])
1 Like

We used to say a busy computer is a happy computer!

1 Like

Do you have any alarms or previous timers in it?

1 Like

Yes, I have an disabled test alarm set for 17:02. Do you think gnome-clock is polling every second for it, even if it is disabled? I will remove it to check.

1 Like

I removed this entry and rebooted. The gnome-clock gets every second a wakeup and writes the current epoch seconds to somewhere:

15:19:35 ppoll([{fd=4, events=POLLIN}, {fd=8, events=POLLIN}, {fd=11, events=POLLIN}, {fd=15, events=POLLIN}], 4, NULL, NULL, 0) = 1 ([{fd=15, revents=POLLIN}])
15:19:36 write(4, "\1\0\0\0\0\0\0\0", 8) = 8
15:19:36 timerfd_create(CLOCK_REALTIME, TFD_CLOEXEC) = 16
15:19:36 timerfd_settime(16, TFD_TIMER_ABSTIME|TFD_TIMER_CANCEL_ON_SET, {it_interval={tv_sec=0, tv_nsec=0}, it_value={tv_sec=1742825977, tv_nsec=0}}, NULL) = 0
15:19:36 write(4, "\1\0\0\0\0\0\0\0", 8) = 8
15:19:36 close(15)                      = 0
15:19:36 ppoll([{fd=4, events=POLLIN}, {fd=8, events=POLLIN}, {fd=11, events=POLLIN}, {fd=16, events=POLLIN}], 4, NULL, NULL, 0) = 1 ([{fd=4, revents=POLLIN}])
15:19:36 read(4, "\2\0\0\0\0\0\0\0", 16) = 8
15:19:36 ppoll([{fd=4, events=POLLIN}, {fd=8, events=POLLIN}, {fd=11, events=POLLIN}, {fd=16, events=POLLIN}], 4, NULL, NULL, 0) = 1 ([{fd=16, revents=POLLIN}])
15:19:37 write(4, "\1\0\0\0\0\0\0\0", 8) = 8
15:19:37 timerfd_create(CLOCK_REALTIME, TFD_CLOEXEC) = 15
15:19:37 timerfd_settime(15, TFD_TIMER_ABSTIME|TFD_TIMER_CANCEL_ON_SET, {it_interval={tv_sec=0, tv_nsec=0}, it_value={tv_sec=1742825978, tv_nsec=0}}, NULL) = 0
15:19:37 write(4, "\1\0\0\0\0\0\0\0", 8) = 8
15:19:37 close(16)                      = 0
2 Likes

Where are the sources to clone?

1 Like

I filed an issue in gnome-clocks cycles in a loop draining battery in my Purism L5 (#396) · Issues · GNOME / Clocks · GitLab

1 Like

Hi guru,

i install strace on my daily driver L5 with less apps. And run Version 40 of gnome-Clocks and my Clock sleep in strace fine. - I have no world clock set and only one deactivated alarm and a stop counter.

I saw normal function. It Wakes up only every minute when my Phone-Shell Minute Timer need to update, like from 21:49 to 21:50 o Clock.

Play around a little more and for me it seems like other apps nudge the clock too. Playing a Song in Lollypop, or have /usr/share/xkb receive some onscreen push.

If i do Nothing the strace sleep fine till it reach a full Minute.

Do you use ssh login to observe or some attached keyboard? In my logs i find a string which Binary nudge gnome-clocks for interaction. Can you just scroll more lines up in your log?

Regards

Chris

3 Likes

This gave me a hint: I’ve set since ages that the displayed time should also show the seconds, with:

gsettings set org.gnome.desktop.interface clock-show-seconds true

When I set it to false, the app is waked up only once in a minute. When I set it to true again, the strace shows again the wake up at any second. I see it even with strace (via SSH) whhen the display is off.

5 Likes

Just to be clear, for me this bug is not solved, there is no reason to stress another process when phosh wants to update the displayed time. This is just bad design

4 Likes

The issue https://gitlab.gnome.org/GNOME/gnome-clocks/-/issues/396 was closed today with the reason, that our version of gnome-clock is very outdated :frowning:

2 Likes

Just a short message. When you have it wake up every second, it will eat more battery by definition. Because it have to be present every second… so this is not “very outdated” its some kind of ugly configuration.

Posh here, give me the right ±1 Minute time if i wake it up. If you have to measure seconds or less, try the stop watch function or some real time script with date..

I have right now gnome clock Version 49, and it still can not wake up my crimson phone for alarming in suspend sleep. But i expected nothing else right now.

Edit: I done the strace again. It runs less then a second with 0, 07, 22, 37 seconds… and done the alarm as expected. I think they patched the eating up every second in a higher version and closed the but because of this.

1 Like