Bug 1450628

Summary: timedatex high CPU usage
Product: [Fedora] Fedora Reporter: Gwendal <ezwen-redhatbugzilla>
Component: timedatexAssignee: Miroslav Lichvar <mlichvar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: bugzilla, eugenemah, fredoche, jakub_o, klember, mclasen, mlichvar, mvollmer
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: timedatex-0.5-2.fc27 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-23 21:44:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
cpu use none

Description Gwendal 2017-05-14 05:54:12 UTC
Description of problem:

For some reason, timedatex has been continuously using 100% CPU time. Reboots don't change anything to the problem.

Since this makes my CPU fan a bit noisy, my only workaround is "sudo pkill timedatex".

And nothing interesting can be found in the logs :(

$ journalctl -u timedatex -b
-- Logs begin at Sat 2016-07-02 18:08:31 CEST, end at Sun 2017-05-14 07:47:50 CEST. --
mai 14 07:45:41 goudurix systemd[1]: Starting System clock and RTC settings service...
mai 14 07:45:41 goudurix systemd[1]: Started System clock and RTC settings service.

Version-Release number of selected component (if applicable):
- fedora 26
- linux 4.11.0-2.fc26.x86_64
- timedatex-0.4-3.fc26

How reproducible: After each reboot, at least on my system


Steps to Reproduce:
1. Start the system

Actual results: I see "100%" CPU time for timedatex in htop


Expected results: Less CPU time?

Comment 1 Serg Redkin 2017-05-14 21:12:07 UTC
Created attachment 1278721 [details]
cpu use

Comment 2 Serg Redkin 2017-05-14 21:15:06 UTC
Comment on attachment 1278721 [details]
cpu use

one core of the four - loads 100%.
OS: Fedora 26 (Workstation Edition) x86_64 
Kernel: 4.11.0-2.fc26.x86_64 
Uptime: 42 mins 
Packages: 1841 
Shell: bash 4.4.12 
Resolution: 1920x1200 
DE: GNOME 
WM: GNOME Shell 
WM Theme: Adwaita 
Theme: Numix [GTK2/3] 
Icons: Numix [GTK2/3] 
Terminal: gnome-terminal 
CPU: Intel i5-3570K (4) @ 4.200GHz 
GPU: Intel Ivybridge Desktop 
Memory: 2190MiB / 15733MiB

Comment 3 fred 2017-05-15 07:18:03 UTC
I confirm, same issue here

Comment 4 Miroslav Lichvar 2017-05-15 07:34:51 UTC
I can reproduce it. It seems it was caused by the update of the glib2 package to 2.52.2-1.fc26.

Comment 5 Serg Redkin 2017-05-15 07:44:36 UTC
This leads to increased power consumption, because the intel technology does not work for lowering the frequency of the processor.

Comment 6 Miroslav Lichvar 2017-05-15 08:34:24 UTC
It seems this is related to

https://bugzilla.gnome.org/show_bug.cgi?id=761102

and this commit should fix it 
https://git.gnome.org/browse/glib/commit/?id=9ba95e25b74adf8d62effeaf6567074ac932811c

Here is a minimal reproducer from the timedatex code. It should exit when nothing happens for 30 seconds, but the g_timeout_add() call seems to cause g_main_context_iteration() to immediately return, creating an infinite loop.

#include <glib.h>
#include <glib/gstdio.h>

static gboolean main_quit = FALSE;

static gboolean stop_main_loop(gpointer user_data) {
        main_quit = TRUE;
        return TRUE;
}

int main(int argc, char **argv) {
        guint timeout_id = 0;
        int iter = 0;

        while (!main_quit) {
                timeout_id = g_timeout_add(30 * 1000, stop_main_loop, NULL);

                fprintf(stderr, "iteration %d\n", iter++);
                g_main_context_iteration(g_main_context_default(), TRUE);

                if (timeout_id)
                        g_source_remove(timeout_id);
                timeout_id = 0;
        }

        return 0;
}

Comment 7 Kalev Lember 2017-05-15 08:57:24 UTC
Thanks, I've backported the upstream fix to glib2-2.52.2-2.fc26

Comment 8 Fedora Update System 2017-05-15 09:18:36 UTC
glib2-2.52.2-2.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-27fbf57af3

Comment 9 Fedora Update System 2017-05-15 22:05:26 UTC
glib2-2.52.2-2.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-27fbf57af3

Comment 10 Fedora Update System 2017-05-16 00:56:32 UTC
glib2-2.52.2-2.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Serg Redkin 2017-05-16 05:59:37 UTC
after update and reboot all working very well. Thanks for good job!

Comment 12 Miroslav Lichvar 2017-05-16 07:09:12 UTC
*** Bug 1451144 has been marked as a duplicate of this bug. ***

Comment 13 Miroslav Lichvar 2017-05-16 08:49:16 UTC
*** Bug 1451254 has been marked as a duplicate of this bug. ***

Comment 14 Miroslav Lichvar 2017-05-18 10:11:56 UTC
*** Bug 1452079 has been marked as a duplicate of this bug. ***

Comment 15 Miroslav Lichvar 2018-01-10 16:15:07 UTC
This issue has reappeared with glib2-2.54.3. It will be fixed in timedatex. See https://github.com/mlichvar/timedatex/issues/4 for more information.

Comment 16 Miroslav Lichvar 2018-01-10 16:39:44 UTC
It should be fixed in timedatex-0.5-2.fc27.

Kalev, could you please submit a new F27 glib2+timedatex update?

Comment 17 Sandro Bonazzola 2018-01-11 07:25:54 UTC
(In reply to Miroslav Lichvar from comment #16)
> It should be fixed in timedatex-0.5-2.fc27.
> 
> Kalev, could you please submit a new F27 glib2+timedatex update?

I don't see any update for timedatex in bodhi for fc27.
Can you check https://koji.fedoraproject.org/koji/buildinfo?buildID=1015536 has been pushed for updates stable?

Comment 18 Sandro Bonazzola 2018-01-11 07:28:23 UTC
I can confirm that https://koji.fedoraproject.org/koji/buildinfo?buildID=1015536 solves 100% cpu usage on x86_64 on my laptop.

Comment 19 Fedora Update System 2018-01-11 07:33:37 UTC
glib2-2.54.3-1.fc27 timedatex-0.5-2.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-4745a9bbeb

Comment 20 Fedora Update System 2018-01-11 07:33:48 UTC
glib2-2.54.3-1.fc27 timedatex-0.5-2.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-4745a9bbeb

Comment 21 Kalev Lember 2018-01-11 07:35:51 UTC
(In reply to Miroslav Lichvar from comment #16)
> It should be fixed in timedatex-0.5-2.fc27.
> 
> Kalev, could you please submit a new F27 glib2+timedatex update?

Done! Thanks for fixing it, Miroslav.

Comment 22 Eugene Mah 2018-01-11 12:29:00 UTC
The new timedatex update fixes the 100% CPU usage I was seeing on my desktops

Comment 23 Fedora Update System 2018-01-11 23:07:55 UTC
glib2-2.54.3-1.fc27, timedatex-0.5-2.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-4745a9bbeb

Comment 24 Fedora Update System 2018-01-18 12:03:33 UTC
glib2-2.54.3-2.fc27 timedatex-0.5-2.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-4745a9bbeb

Comment 25 Fedora Update System 2018-01-19 00:33:44 UTC
glib2-2.54.3-2.fc27, timedatex-0.5-2.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-4745a9bbeb

Comment 26 Fedora Update System 2018-01-23 21:44:10 UTC
glib2-2.54.3-2.fc27, timedatex-0.5-2.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.