Bug 2437484

Summary: tuned-ppd frequently fails to start on Fedora 44 with "There is no main context set for thread"
Product: [Fedora] Fedora Reporter: Adam Williamson <awilliam>
Component: pygobject3Assignee: GNOME SIG Unassigned <gnome-sig>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 44CC: amigadave, benjamin-fedora, farchord, gnome-sig, jskarvad, kalevlember, mclasen, otaylor, pzacik, robatino, tpopela
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: openqa
Fixed In Version: pygobject3-3.55.3-2.fc44 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2026-02-09 23:47:39 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:
Bug Depends On:    
Bug Blocks: 2362357    

Description Adam Williamson 2026-02-07 02:32:05 UTC
This is weird, and I'll dig into it more, but I'm reporting what I know so far just to get it on the record.

Since we branched F44, the base_services_start test in openQA (which checks all enabled services started successfully) is frequently failing on KDE and GNOME because tuned-ppd fails to start correctly. In the journal we see:

Feb 06 20:57:39 fedora systemd[1]: Started tuned.service - Dynamic System Tuning Daemon.
Feb 06 20:57:39 fedora audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=tuned comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Feb 06 20:57:39 fedora tuned[1041]: Exception in thread Thread-3 (_thread_code):
Feb 06 20:57:39 fedora systemd[1]: Starting tuned-ppd.service - PPD-to-TuneD API Translation Daemon...
Feb 06 20:57:39 fedora tuned[1041]: Traceback (most recent call last):
Feb 06 20:57:39 fedora tuned[1041]:   File "/usr/lib64/python3.14/threading.py", line 1082, in _bootstrap_inner
Feb 06 20:57:39 fedora tuned[1041]:     self._context.run(self.run)
Feb 06 20:57:39 fedora tuned[1041]:     ~~~~~~~~~~~~~~~~~^^^^^^^^^^
Feb 06 20:57:39 fedora tuned[1041]:   File "/usr/lib64/python3.14/threading.py", line 1024, in run
Feb 06 20:57:39 fedora tuned[1041]:     self._target(*self._args, **self._kwargs)
Feb 06 20:57:39 fedora tuned[1041]:     ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 06 20:57:39 fedora tuned[1041]:   File "/usr/lib/python3.14/site-packages/tuned/exports/dbus_exporter.py", line 222, in _thread_code
Feb 06 20:57:39 fedora tuned[1041]:     self._main_loop.run()
Feb 06 20:57:39 fedora tuned[1041]:     ~~~~~~~~~~~~~~~~~~~^^
Feb 06 20:57:39 fedora tuned[1041]:   File "/usr/lib64/python3.14/site-packages/gi/overrides/GLib.py", line 584, in run
Feb 06 20:57:39 fedora tuned[1041]:     get_event_loop(self.get_context()).running(self.quit),
Feb 06 20:57:39 fedora tuned[1041]:     ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
Feb 06 20:57:39 fedora tuned[1041]:   File "/usr/lib64/python3.14/site-packages/gi/_ossighelper.py", line 270, in get_event_loop
Feb 06 20:57:39 fedora tuned[1041]:     loop = events.GLibEventLoopPolicy._get_event_loop()
Feb 06 20:57:39 fedora tuned[1041]:   File "/usr/lib64/python3.14/site-packages/gi/events.py", line 866, in _get_event_loop
Feb 06 20:57:39 fedora tuned[1041]:     raise RuntimeError(
Feb 06 20:57:39 fedora tuned[1041]:         f"There is no main context set for thread {threading.current_thread().name!r}."
Feb 06 20:57:39 fedora tuned[1041]:     )
Feb 06 20:57:39 fedora tuned[1041]: RuntimeError: There is no main context set for thread 'Thread-3 (_thread_code)'.

This is weird because it's *not* happening on Rawhide, AFAICT. Rawhide tests seem fine. But tuned has not changed since September, and the very same version is tagged in both Rawhide and F44. So I'm not sure what's going on, but something's weird. I'll have to workaround this in openQA till we can figure it out.

Comment 1 Adam Williamson 2026-02-08 16:40:54 UTC
I *think* this may be caused by the GNOME 50 update, somehow, because the GNOME 50 update landed on F44 before Rawhide, and now it's in testing for Rawhide, this test failed on it several times:

https://openqa.fedoraproject.org/tests/4245468
https://openqa.fedoraproject.org/tests/4245342
https://openqa.stg.fedoraproject.org/tests/5877742
https://openqa.stg.fedoraproject.org/tests/5877613

The pattern of failures is odd, too. Looking at the F44 results, it fails almost every time on aarch64 KDE. It fails about half the time on x86_64 KDE. It fails about half the time on aarch64 GNOME. It rarely fails on x86_64 GNOME.

So it feels like some kind of a timing issue. I don't know *what* in the GNOME 50 update might be causing it, though.

Comment 2 Adam Williamson 2026-02-08 16:53:33 UTC
Hmm, also interesting, in at least one of the Rawhide cases the messages are in a different order:

Feb 08 11:04:55 fedora systemd[1]: Starting tuned.service - Dynamic System Tuning Daemon...
...
Feb 08 11:04:55 fedora tuned[1027]: Exception in thread Thread-3 (_thread_code):
Feb 08 11:04:55 fedora rsyslogd[1094]: imjournal: journal files changed, reloading...  [v8.2510.0-3.fc44 try https://www.rsyslog.com/e/0 ]
Feb 08 11:04:55 fedora tuned[1027]: Traceback (most recent call last):
Feb 08 11:04:55 fedora tuned[1027]:   File "/usr/lib64/python3.14/threading.py", line 1082, in _bootstrap_inner
Feb 08 11:04:55 fedora tuned[1027]:     self._context.run(self.run)
Feb 08 11:04:55 fedora tuned[1027]:     ~~~~~~~~~~~~~~~~~^^^^^^^^^^
Feb 08 11:04:55 fedora tuned[1027]:   File "/usr/lib64/python3.14/threading.py", line 1024, in run
Feb 08 11:04:55 fedora tuned[1027]:     self._target(*self._args, **self._kwargs)
Feb 08 11:04:55 fedora tuned[1027]:     ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 08 11:04:55 fedora tuned[1027]:   File "/usr/lib/python3.14/site-packages/tuned/exports/dbus_exporter.py", line 222, in _thread_code
Feb 08 11:04:55 fedora tuned[1027]:     self._main_loop.run()
Feb 08 11:04:55 fedora tuned[1027]:     ~~~~~~~~~~~~~~~~~~~^^
Feb 08 11:04:55 fedora tuned[1027]:   File "/usr/lib64/python3.14/site-packages/gi/overrides/GLib.py", line 584, in run
Feb 08 11:04:55 fedora tuned[1027]:     get_event_loop(self.get_context()).running(self.quit),
Feb 08 11:04:55 fedora tuned[1027]:     ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
Feb 08 11:04:55 fedora tuned[1027]:   File "/usr/lib64/python3.14/site-packages/gi/_ossighelper.py", line 270, in get_event_loop
Feb 08 11:04:55 fedora tuned[1027]:     loop = events.GLibEventLoopPolicy._get_event_loop()
Feb 08 11:04:55 fedora tuned[1027]:   File "/usr/lib64/python3.14/site-packages/gi/events.py", line 866, in _get_event_loop
Feb 08 11:04:55 fedora tuned[1027]:     raise RuntimeError(
Feb 08 11:04:55 fedora tuned[1027]:         f"There is no main context set for thread {threading.current_thread().name!r}."
Feb 08 11:04:55 fedora tuned[1027]:     )
Feb 08 11:04:55 fedora tuned[1027]: RuntimeError: There is no main context set for thread 'Thread-3 (_thread_code)'.
Feb 08 11:04:55 fedora audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=tuned comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Feb 08 11:04:55 fedora systemd[1]: Started tuned.service - Dynamic System Tuning Daemon.
Feb 08 11:04:55 fedora systemd-logind[906]: New session 'c1' of user 'plasmalogin' with class 'greeter' and type 'wayland'.
Feb 08 11:04:55 fedora systemd[1]: Starting tuned-ppd.service - PPD-to-TuneD API Translation Daemon...
...
Feb 08 11:05:21 fedora tuned-ppd[1113]: ERROR:dbus.proxies:Introspect error on :1.20:/Tuned: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
...
Feb 08 11:05:40 fedora systemd[1]: tuned-ppd.service: start operation timed out. Terminating.
Feb 08 11:05:40 fedora systemd[1]: tuned-ppd.service: Failed with result 'timeout'.
Feb 08 11:05:40 fedora systemd[1]: Failed to start tuned-ppd.service - PPD-to-TuneD API Translation Daemon.

So it's like we get the threading issue in tuned *before* tuned-ppd starts up, then it causes tuned-ppd to fail (but tuned itself is still counted as successfully started)...

I wonder if something in the update changes the startup order so tuned starts earlier and that causes the problem, or something like that?

Comment 3 Adam Williamson 2026-02-08 22:12:17 UTC
Ah, no, maybe there's a more likely suspect. Looking through the things updated when you install the GNOME 50 megaupdate on a KDE system, I see python3-gobject-base , and tuned requires that. Assigning there for now.

Comment 4 Benjamin Berg 2026-02-09 07:18:39 UTC
Uh, right, yes, that shouldn't assert when _get_event_loop is called (i.e. the underscore version). Upstream pygobject bug that was recently introduced.

Comment 5 Benjamin Berg 2026-02-09 07:26:46 UTC
This should fix it: https://gitlab.gnome.org/GNOME/pygobject/-/merge_requests/518

Though I am a bit surprised that tuned-ppd actually manages to start a thread, not set a main context for it and still manages to hit this code path. That smells to me like they forgot a call to GLib.MainContext.push_thread_default.

Comment 6 Tomas Popela 2026-02-09 09:08:29 UTC
Thank you Benjamin! Adam, I've created https://src.fedoraproject.org/rpms/pygobject3/pull-request/18 with the proposed change.

Comment 7 Tomas Popela 2026-02-09 12:56:25 UTC
Seems that the fix indeed fixes the issue - before the Power panel in GNOME Control Center needed some time to load, but now it's instant which I suspect was a side effect of the problem). I also don't see any tuned related problems in journal.

Comment 9 Adam Williamson 2026-02-09 23:42:27 UTC
*** Bug 2438347 has been marked as a duplicate of this bug. ***