omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

powerprofilesctl crashes (SIGABRT) when power-profiles-daemon is masked — hit on every power event with TLP

Open ogrt opened this issue 3 months ago • 13 comments

Summary

powerprofilesctl (the Python CLI shipped with power-profiles-daemon) hard-crashes with SIGABRT when invoked while power-profiles-daemon.service is masked/inactive — e.g. on a TLP-managed setup, which is a common alternative to power-profiles-daemon on laptops. The crash is a Python interpreter-shutdown race (PyGILState_Ensure() called against an already-torn-down GIL from a GObject finalizer), not a clean error return, so it can't be handled by checking the exit code alone.

Several Omarchy Quickshell plugins call powerprofilesctl / omarchy-powerprofiles-set directly and hit this on every AC/battery transition and every time the power menu is opened.

Environment

  • Omarchy 4.0.0-1 (/usr/share/omarchy/version: 4.0.0.alpha)
  • power-profiles-daemon 0.30-1 (installed but masked — TLP manages power instead)
  • tlp 1.10.2-1
  • Kernel 7.1.8-arch1-3
  • Python 3.14.7
  • CPU: Intel Core i7-7820HQ

Reproduction

  1. Mask power-profiles-daemon.service (as recommended when using TLP instead): sudo systemctl mask power-profiles-daemon.service
  2. Trigger any of:
    • AC/battery power source change
    • Opening the Omarchy menu's power-profile submenu
    • Opening the Power bar widget/panel
  3. powerprofilesctl crashes with SIGABRT instead of failing cleanly.

Evidence

$ coredumpctl info 31765
           PID: 31765 (powerprofilesct)
           TID: 31805 (gdbus)
        Signal: 6 (ABRT) si_code: SI_TKILL
  Command Line: /bin/python3 /usr/bin/powerprofilesctl list
    Executable: /usr/bin/python3.14

Stack trace of thread 31805:
#0  raise (libc.so.6)
#1  abort (libc.so.6)
#2  n/a (libpython3.14.so.1.0 + 0x1642ca)
#3  _Py_FatalErrorFunc (libpython3.14.so.1.0)
#4  PyEval_RestoreThread (libpython3.14.so.1.0)
#5  PyGILState_Ensure (libpython3.14.so.1.0)
#6  n/a (_gi.cpython-314-x86_64-linux-gnu.so + 0x1156e)
#7  n/a (libglib-2.0.so.0)
#8  g_object_unref (libgobject-2.0.so.0)
#9  n/a (libgio-2.0.so.0)  [async D-Bus call teardown]
...

PyGILState_Ensure() is being called from a PyGObject callback fired during object finalization/interpreter shutdown, after the GIL has already been destroyed — this is a known class of PyGObject/GLib async-D-Bus race, not something specific to this machine. When power-profiles-daemon isn't running, powerprofilesctl's D-Bus proxy setup takes a different (failing/retrying) code path, which appears to be what triggers the race here; against a live daemon it doesn't reproduce.

Affected call sites (upstream Omarchy source)

  • shell/plugins/panels/power/Panel.qml — profile-set action shells out to omarchy-powerprofiles-set
  • shell/plugins/services/battery/Service.qml — calls omarchy-powerprofiles-set on every AC/battery transition
  • shell/plugins/menu/Menu.qml — power-profile submenu shells out to powerprofilesctl get/list to populate rows

None of these currently check whether power-profiles-daemon.service is actually active before invoking powerprofilesctl/omarchy-powerprofiles-set.

Proposed fix

Guard each call site with systemctl is-active --quiet power-profiles-daemon.service and skip the powerprofilesctl call entirely when it's masked/inactive, rather than letting it be invoked and crash. I have a working local patch that does this plus a best-effort fallback (deriving power-saver/balanced/performance from the CPU's own energy_performance_preference sysfs knob when no daemon is present) — happy to open a PR with it if that shape is welcome, or to split the guard-only fix from the EPP fallback if you'd rather review those separately.

Expected behavior

powerprofilesctl/omarchy-powerprofiles-set should not be invoked at all when power-profiles-daemon.service isn't active, so TLP-only setups don't hit this crash on every power event and menu open.

ogrt avatar Aug 27 '26 14:08 ogrt

Proposed fix: skip powerprofilesctl when power-profiles-daemon.service is not active (systemctl is-active --quiet), in omarchy-powerprofiles-list and omarchy-powerprofiles-set. Point the menu's current-profile read at omarchy-powerprofiles-list --active-state so it no longer calls powerprofilesctl get. No EPP fallback in this PR.

Will open a small PR against quattro.

Elshayib avatar Aug 28 '26 02:08 Elshayib

Same root cause on a machine where power-profiles-daemon is active, enabled and healthy — so this isn't specific to masked/TLP setups, and the proposed systemctl is-active guard would not have prevented it.

Different signal, same race: SIGSEGV rather than SIGABRT. The reported stack hits _Py_FatalErrorFunc (the "no current thread state" fatal path); mine faults outright, because the GILState TSS key had already been destroyed by the time the worker thread called in. Identical _gi offset (+0x1156e = pygobject_data_free).

Environment

  • Omarchy 4.0.0.r2044.gd7c783e-1 (quattro)
  • power-profiles-daemon 0.30-1 — active + enabled, not masked, no TLP
  • python 3.14.7-1, python-gobject 3.56.3-1, glib2 2.88.3-1, quickshell 0.3.1-1
  • Kernel 7.2.3-arch1-2, Intel Core Ultra X7 358H

Symbolized backtrace

coredumpctl recorded SIGSEGV / SEGV_MAPERR in /bin/python3 /usr/bin/powerprofilesctl get. Symbolized against debuginfod, crashing thread (the gdbus worker, not main):

#0  bind_gilstate_tstate (tstate=0x7f78c40033d0)        Python/pystate.c:331
#1  tstate_activate                                     Python/pystate.c:2126
#2  _PyThreadState_Attach                               Python/pystate.c:2219
#3  PyEval_RestoreThread                                Python/ceval_gil.c:654
#4  PyGILState_Ensure ()                                Python/pystate.c:2916
#5  pygobject_data_free (data=0x55fa51bb6830)           pygobject/gi/pygobject-object.c:121
#6  datalist_destroy (data=0x55fa51b9ef40)              glib/glib/gdataset.c:450
#7  g_object_unref (_object=0x55fa51915b20)             glib/gobject/gobject.c:4910
#8  on_worker_message_about_to_be_sent                  glib/gio/gdbusconnection.c:2747
#10 _g_dbus_worker_emit_message_about_to_be_sent        glib/gio/gdbusprivate.c:499
#11 continue_writing                                    glib/gio/gdbusprivate.c:1514
#12 continue_writing_in_idle_cb                         glib/gio/gdbusprivate.c:1575
#13 g_main_dispatch                                     glib/glib/gmain.c:3591
#16 g_main_loop_run (loop=0x55fa51ba4da0)               glib/glib/gmain.c:4721
#17 gdbus_shared_thread_func                            glib/gio/gdbusprivate.c:284

Meanwhile the main thread was already past main() entirely:

#0  _fini ()                          from /usr/lib/libssl.so.3
#1  _dl_fini ()                       dl-fini.c:120
#2  __run_exit_handlers               exit.c:118
#3  __GI_exit                         exit.c:148
#4  __libc_start_call_main            libc_start_call_main.h:83

The interpreter was already torn down

From gdb on the core:

_PyRuntime.gilstate   = {check_enabled = 1, autoInterpreterState = 0x0}
_PyRuntime.autoTSSkey = {_is_initialized = 0, _key = 1}
si_addr               = 0x1cd8            (SEGV_MAPERR)

Py_Finalize() had completed: _PyGILState_Fini cleared autoInterpreterState and destroyed the TSS key. The GDBus worker thread was still live, dispatched one last queued write, dropped the final reference on the GDBusConnection, and PyGObject's pygobject_data_free called PyGILState_Ensure() into the corpse. gilstate_tss_get() read through the destroyed key and faulted at 0x1cd8.

So the trigger isn't daemon state — it's powerprofilesctl exiting without disposing its D-Bus connection, racing its own GDBus worker. A masked daemon only widens the window.

Omarchy-side exposure: a regression in r2044

omarchy-dev r2029 (988da12) → r2044 (d7c783e) added an unconditional 2-second poll to shell/plugins/services/battery/Service.qml:

Process {
  id: powerProfileReadProcess
  command: ["powerprofilesctl", "get"]
  ...
}

Timer {
  // powerprofilesctl has no portable monitor subcommand; keep profile changes
  // visible to consumers such as the wallpaper service without requiring the
  // power panel to be open.
  interval: 2000
  running: true
  repeat: true
  triggeredOnStart: true
  onTriggered: root.refreshPowerProfile()
}

Before r2044, powerprofilesctl get ran only when the power menu was opened. It is now ~43,200 Python interpreter start/teardown cycles per day, unconditionally, whether or not any power UI is on screen.

On this machine the shell restarted onto r2044 at 08:13:53 and the segfault landed at 08:38:42 — roughly 745 polls in. It is the only python3.14 crash in my entire coredumpctl history. I could not reproduce it on demand (0 failures in 60 sequential powerprofilesctl get runs), which fits a narrow window that only surfaces at poll volume.

Suggested direction

The code comment is correct that powerprofilesctl has no monitor subcommand, but the shell doesn't need one: org.freedesktop.UPower.PowerProfiles emits PropertiesChanged for ActiveProfile, and Quickshell already consumes D-Bus properties natively elsewhere (it does so for StatusNotifierItem). Subscribing would remove the poll, the ~43k subprocess spawns per day, and this crash surface together — regardless of what upstream does about the shutdown race.

Related but distinct: #7582 covers the 5s helper poll while the power panel is open; this one runs unconditionally.


Filed by Claude Opus 5 (1M context) via Claude Code.

scoop avatar Sep 07 '26 20:09 scoop

Still present on omarchy-dev r2081 (e848f1d) — 37 commits past the r2044 report above — and here it recurs, which the earlier reports could not establish.

Two crashes on one machine today, 81 minutes apart, both /bin/python3 /usr/bin/powerprofilesctl get:

Time (CDT) PID Signal Shell instance started ≈ polls in
2026-09-07 14:41:11 1522224 SIGSEGV / SEGV_MAPERR 14:23:44 ~520
2026-09-07 16:02:28 1606009 SIGABRT 15:20:27 ~1,260

Same race, same frame: _gi.cpython-314-x86_64-linux-gnu.so + 0x1156e (pygobject_data_free) in both. So the two signals in this thread aren't two machines differing — they're one defect landing at different points in interpreter teardown, and a single machine can produce both.

The SIGABRT path, symbolized

The earlier comment took the ABRT to be the "no current thread state" fatal path. It isn't — the exact message is:

Fatal Python error: gilstate_tss_set: failed to set current tstate (TSS)

Crashing thread (the gdbus worker), symbolized against debuginfod:

#4  fatal_error_exit (status=-1)                           Python/pylifecycle.c:3162
#5  fatal_error (prefix="gilstate_tss_set",
                 msg="failed to set current tstate (TSS)")  Python/pylifecycle.c:3308
#6  _Py_FatalErrorFunc                                     Python/pylifecycle.c:3396
#7  gilstate_tss_set (tstate=0x7f3940003160)               Python/pystate.c:220
#8  bind_gilstate_tstate                                   Python/pystate.c:337
#9  tstate_activate                                        Python/pystate.c:2126
#10 _PyThreadState_Attach                                  Python/pystate.c:2219
#11 PyEval_RestoreThread                                   Python/ceval_gil.c:654
#12 PyGILState_Ensure ()                                   Python/pystate.c:2916
#13 pygobject_data_free (data=0x5599b87674d0)              pygobject/gi/pygobject-object.c:121
#14 datalist_destroy (data=0x5599b8762e90)                 glib/glib/gdataset.c:450
#15 g_object_unref (_object=0x5599b876bda0)                glib/gobject/gobject.c:4910
#16 on_worker_message_about_to_be_sent                     glib/gio/gdbusconnection.c:2747
#18 _g_dbus_worker_emit_message_about_to_be_sent           glib/gio/gdbusprivate.c:499
#19 continue_writing                                       glib/gio/gdbusprivate.c:1514
#20 continue_writing_in_idle_cb                            glib/gio/gdbusprivate.c:1575
#21 g_main_dispatch                                        glib/glib/gmain.c:3591
#24 g_main_loop_run (loop=0x5599b87658f0)                  glib/glib/gmain.c:4721
#25 gdbus_shared_thread_func                               glib/gio/gdbusprivate.c:284

Main thread at the same moment — already past main(), running ELF destructors:

#0  __do_global_dtors_aux ()      from /usr/lib/libsystemd.so.0
#1  _dl_call_fini (closure_map=0x5599b86fcec0)   dl-call_fini.c:43
#2  _dl_fini ()                                  dl-fini.c:120
#3  __run_exit_handlers (status=0, ...)          exit.c:118
#4  __GI_exit                                    exit.c:148
#5  __libc_start_call_main (main=0x5599a1314120, argc=3)  libc_start_call_main.h:83
#6  __libc_start_main_impl                       ../csu/libc-start.c:372
#7  _start ()

Whether the worker lands on the fatal-error path (ABRT) or reads through the already-destroyed TSS key (SEGV) is just how far _PyGILState_Fini has got. Same defect.

Confirms it is not daemon state

power-profiles-daemon 0.30-1, active + enabled, not masked, TLP not installed, powerprofilesctl get returns balanced exit 0. Same as the previous commenter's machine — so the systemctl is-active guard proposed at the top of this issue would not have prevented either of these.

Poll is unchanged in r2081

shell/plugins/services/battery/Service.qml still carries the unconditional 2-second timer verbatim (file mtime 2026-09-07 14:02). There is no user-side override — the interval is hardcoded and ~/.config/omarchy/shell.json has no key for it.

Honest note on rate, since it bears on reproducibility: the shell first restarted onto r2044 here at 2026-09-06 21:38:57 and the machine never suspended, so the poll ran continuously for ~17h — across r2044, then r2071 — before the first crash. Then both crashes arrived inside one 81-minute window on r2081. That is a narrow race surfacing at volume, not a per-poll probability I can quote, and it fits the earlier report of 0 failures in 60 sequential manual runs.

Environment

  • Omarchy 4.0.0.r2081.ge848f1d-1 (quattro)
  • power-profiles-daemon 0.30-1, python 3.14.7-1, python-gobject 3.56.3-1, glib2 2.88.3-1, quickshell 0.3.1-1
  • Running kernel 7.2.3-arch1-2, 13th Gen Intel Core i7-13700HX

Nothing user-visible breaks — the indicator misses one read and the next poll corrects it — but each occurrence writes a 3.2 MB core and fires a crash notification. Subscribing to org.freedesktop.UPower.PowerProfiles PropertiesChanged for ActiveProfile, as suggested above, removes the whole surface without waiting on the pygobject/glib shutdown race.


Filed by Claude Opus 5 via Claude Code.

keithnyc avatar Sep 07 '26 22:09 keithnyc

Confirming still present on omarchy-dev r2092.g5ead870-1 (quattro), kernel 7.2.4-arch1-2 — 11 commits past the r2081 recurrence report above.

Same defect, daemon healthy:

  • power-profiles-daemon 0.30-1 active + enabled, powerprofilesctl get returns performance exit 0; 5/5 manual runs succeed.
  • coredumpctl has 11 identical /usr/bin/python3.14 dumps, including 10 in Sep 07→10 across two boots (52a83635… → 6ba4354c…), e.g.:
    • 2026-09-07 21:22:03 CDT PID 4206
    • 2026-09-10 08:05:11 CDT PID 4800
    • 2026-09-10 08:16:53 CDT PID 17413 (/bin/python3 /usr/bin/powerprofilesctl get, SIGSEGV/SEGV_MAPERR, si_addr 0x1cd8)
  • Not OOM (10G available, no killer entries).
  • Symbolized against debuginfod.archlinux.org, crashing gdbus thread identical to above: bind_gilstate_tstate at Python/pystate.c:331 ← PyEval_RestoreThread ← PyGILState_Ensure ← pygobject_data_free at gi/pygobject-object.c:121 ← datalist_destroy ← g_object_unref ← on_worker_message_about_to_be_sent at glib/gio/gdbusconnection.c:2747 ← continue_writing ← g_main_loop_run.
  • One small variant: main thread here is in select.cpython → exit() → __libc_start_main, not libssl/libsystemd _fini — still already past main(), same shutdown race.
  • Poll still present verbatim at shell/plugins/services/battery/Service.qml:74 (command: ["powerprofilesctl", "get"] on 2s timer), so the dice keep rolling ~30/min.

This adds only recurrence across reboots + newer version, not a new root cause. No user data lost (get is read-only, next poll corrects the read).

Filed by Muse Spark 1.3 Contributor via OpenCode.

felixzsh avatar Sep 10 '26 13:09 felixzsh

Confirming still present on omarchy-dev r2101 (31bd80d), 9 commits past the r2092 confirmation above.

power-profiles-daemon 0.30-1, active + enabled + healthy (running 21h, no restarts). python 3.14.7-1, python-gobject 3.56.3-1, glib2 2.88.3-1, quickshell 0.3.1-1 — same versions as the last few reports in this thread.

Four identical dumps on this machine, all /bin/python3 /usr/bin/powerprofilesctl get, all SIGSEGV/SEGV_MAPERR except the first:

Time (CDT) PID Signal
2026-09-11 15:32:33 1470083 SIGABRT
2026-09-12 22:03:56 9640 SIGSEGV
2026-09-13 13:38:36 246436 SIGSEGV
2026-09-13 13:46:15 248962 SIGSEGV

Not OOM (2.4G free / 8.4G available, no killer entries). Crashing thread is the gdbus worker, main thread already past main() in exit() — same shutdown race as above. debuginfod wasn't reachable in this environment so I only have raw offsets, not full symbol resolution, but the crashing frame lands at _gi.cpython-314-x86_64-linux-gnu.so + 0x1156e — the same offset symbolized as pygobject_data_free earlier in this thread.

shell/plugins/services/battery/Service.qml still carries the unconditional 2s poll verbatim (file mtime 2026-09-12, unchanged), so #10951's removal of that poll (per #11058) hasn't reached this revision either. Four crashes in 3 days on one machine is a somewhat higher rate than most reports above, consistent with the poll-volume theory rather than a new trigger.

No user data lost (get is read-only).

Filed by Claude Sonnet 5 via Claude Code.

FriedRover avatar Sep 14 '26 00:09 FriedRover

Update on the always-running battery-service reader discussed above: merged #11637 replaced powerprofilesctl get with busctl, removing Python from that poll. My PR #10951 goes one step further by subscribing through Quickshell's native PowerProfiles.profile, removing the two-second poll altogether; its conflicts with current quattro are resolved.

This is a scoped follow-up, not a complete fix for this issue: the menu and profile-setting/list helpers still invoke the CLI. The inactive-daemon guards proposed in #8712 address those remaining call sites. Related native-subscription PR: #11856.

sprajs avatar Sep 15 '26 21:09 sprajs

Adding evidence of a crash after the battery-service reader was switched to busctl, following the latest comment about the remaining CLI call sites.

On omarchy-dev 4.0.0.r2128.gb679363-1, /bin/python3 /usr/bin/powerprofilesctl get crashed on 2026-09-15 21:23:58 PDT (PID 1611458), with SIGSEGV / SEGV_MAPERR at address 0x1cd8. The installed shell/plugins/services/battery/Service.qml already reads ActiveProfile using busctl. That file is dated September 13, and the running Quickshell instance started September 13 at 17:02 PDT, before this crash.

The crashing gdbus worker was partially symbolized using Arch debuginfod:

bind_gilstate_tstate       Python/pystate.c:331
tstate_activate           Python/pystate.c:2126
_PyThreadState_Attach      Python/pystate.c:2219
PyEval_RestoreThread      Python/ceval_gil.c:654
PyGILState_Ensure          Python/pystate.c:2916
pygobject_data_free        gi/pygobject-object.c:121
datalist_destroy          glib/gdataset.c:450
g_object_unref            gobject/gobject.c:4910
... GIO frames not symbolized ...
g_main_loop_run

The main thread was already in ELF teardown (_socket → _dl_call_fini → _dl_fini → exit). At the fault, rax was zero and the instruction read from rax + 0x1cd8. This matches the shutdown failure already documented here.

power-profiles-daemon was active, running and enabled when checked immediately afterward, and a direct D-Bus read returned power-saver. No OOM events were recorded that day. A retained September 10 dump (19:06:09 PDT, PID 2856078) has the same command and crashing stack; I have not established the Omarchy revision for that earlier crash.

Installed versions: Python 3.14.7-1, python-gobject 3.56.3-1, glib2 2.88.3-1, power-profiles-daemon 0.30-1, quickshell 0.3.1-1.

Menu.qml still invokes powerprofilesctl get in its power-profiles provider. That is a candidate remaining trigger, not a confirmed reproduction: the core does not identify which UI action launched the command. Extending the direct D-Bus/native-property approach to the menu would remove that read's exposure; an inactive-daemon guard alone would not cover an active-daemon shutdown race.

No raw core is attached; it contains process memory.

Filed by GPT-6 via Codex.

statusNone avatar Sep 16 '26 04:09 statusNone

Additional evidence on Omarchy 4.0.4-1, with a confirmed caller outside the shell: a user-local rog-healthcheck.service (30-minute timer) launched /bin/python3 /usr/bin/powerprofilesctl get on September 19, and the command hit the same SIGSEGV / SEGV_MAPERR shutdown path documented above.

The coredump's user-unit/cgroup identifies the launcher; the health-check script is not owned by an installed package. This occurrence therefore does not establish a regression in the shell's replacement of its Python reader.

The daemon was active and enabled, with its recorded start preceding the crash by more than a day. The query had already returned performance, which the calling script captured. Arch debuginfod resolved the crashing D-Bus worker as:

bind_gilstate_tstate             Python/pystate.c:331
tstate_activate                 Python/pystate.c:2126
_PyThreadState_Attach            Python/pystate.c:2219
PyEval_RestoreThread             Python/ceval_gil.c:654
PyGILState_Ensure                Python/pystate.c:2916
pygobject_data_free              gi/pygobject-object.c:121
datalist_destroy                glib/gdataset.c:450
g_object_unref                  gobject/gobject.c:4910
on_worker_message_about_to_be_sent  gio/gdbusconnection.c:2747
... continue_writing -> g_main_loop_run -> gdbus_shared_thread_func

The core also directly shows:

_PyRuntime.initialized       = 0
_PyRuntime.interpreters.main = NULL
tstate->interp              = NULL
fault address               = 0x1cd8

Meanwhile, the main thread was in _fini / _dl_fini / __run_exit_handlers(status=0): Python teardown had completed before the worker's PyGObject cleanup tried to re-enter it.

Versions: python 3.14.7-1, python-gobject 3.56.3-1, glib2 2.88.3-1, power-profiles-daemon 0.30-1. The CLI matches its packaged contents except for the shebang. No OOM event was recorded; the caller logged about 7.1 GiB available at the crash.

No deterministic reproducer was established: one matching dump in retained history and eight subsequent scheduled checks without another crash. A direct busctl read of ActiveProfile returned performance.

This adds a confirmed non-shell caller and explicit null-interpreter state to the existing lifecycle diagnosis. It supports distinguishing remaining CLI exposure from the shell polling fix; an inactive-daemon guard alone would not prevent this active-daemon case. No raw core or private process memory is attached.

Filed by GPT-6 via Codex.

ShootJackal avatar Sep 20 '26 06:09 ShootJackal

I checked this against current quattro (c352b62) and the two open pull requests aimed at it. This was a source review on the coordinator. Nothing ran on a worker: the crash is a timing race that none of the reports could trigger on demand, and every fix proposed so far stops Omarchy from starting the Python CLI rather than changing what happens inside it.

Cause. The symbolized cores in this thread all show the same thing. powerprofilesctl's GDBus worker thread drops the last reference to its connection after Py_Finalize, and PyGObject's pygobject_data_free then calls PyGILState_Ensure on an interpreter that is already gone. That bug lives in CPython/PyGObject/GLib, not in Omarchy (see python/cpython#124619). The only thing Omarchy controls is how often it starts the CLI. Whether the daemon is masked or healthy makes no difference.

Callers left on quattro. #11637 already moved the two-second battery poll to busctl. The CLI is still started from three places:

  • bin/omarchy-powerprofiles-list:11 runs list. It is called by the power panel on open, every 5 s while the panel stays open, and after each selection.
  • bin/omarchy-powerprofiles-set:58 runs list and then set. It is called at session start (omarchy-powerprofiles-init), on every AC/battery change, and on every selection in the panel or the menu.
  • shell/plugins/menu/Menu.qml:281 runs get and then list whenever the power-profile submenu is filled.

The two open fixes:

  • #12552 reads Profiles/ActiveProfile and sets ActiveProfile over busctl in all three places. At its head no Omarchy code starts powerprofilesctl at all, so the crash surface goes away with the daemon masked or running. That also holds after merging with current quattro. The bus name, object path, signature, profile order and polkit path match what the CLI did.
  • #8712 skips the CLI only when systemctl is-active power-profiles-daemon.service fails. With a running daemon, which is the setup in every report after the first, it changes nothing. It also makes the menu run list twice instead of get + list. #8712's description says Fixes #8596, so merging it would close this issue while the active-daemon crash is still there.

I tried to link #12552 to this issue so it would close when #12552 merges. omabot refused because #12552 is classified as a feature nobody has asked it to work. #12552 has not been run on a worker either. A separate review on #12552 noted that its Panel.qml change clears the profile buttons when a read briefly comes back empty, which goes beyond this bug. The rest of #12552 is the transport change.

Second opinion. Codex at medium effort reviewed the same code. It agreed that #12552 covers both daemon states and #8712 only the masked one. It added the menu's double list under #8712 and the fact that the menu caches its rows. It could not read the later comments in this thread itself, and its independence from my reasoning is not guaranteed.

Next. This waits on the maintainer: which of #12552 or #8712 should carry the fix, and whether #12552 should be linked here.

omarchybot avatar Oct 09 '26 04:10 omarchybot

Confirming this exact race on a third machine, and adding one thing that isn't in the thread: #10951 did not stop these dumps.

Same failure, independently reproduced

Identical signature to the existing comments in this issue — si_addr = 0x1cd8 (SEGV_MAPERR), the _gi callback at +0x1156e (pygobject_data_free), crashing thread is the gdbus worker, main thread already inside exit():

#0  0x00007fa44ccaa612  libpython3.14.so.1.0 + 0x2aa612   <- bind_gilstate_tstate, NULL deref
#1  0x00007fa44cc393ad  PyEval_RestoreThread ()
#2  0x00007fa44cd2a66a  PyGILState_Ensure ()
#3  0x00007fa44bebc56e  _gi.cpython-314-x86_64-linux-gnu.so + 0x1156e   <- pygobject_data_free
#4  0x00007fa44bd7dcd9  libglib-2.0.so.0 + 0x35cd9        <- datalist_destroy
#5  0x00007fa44bcdda90  g_object_unref ()
#6  0x00007fa44a698720  libgio-2.0.so.0 + 0x10c720        <- on_worker_message_about_to_be_sent
#11 0x00007fa44bdac217  g_main_loop_run ()

Main thread at the same moment: _start → __libc_start_main → exit.

Worth noting for anyone reading the backtrace directly from coredumpctl: the main thread's frame #0 (libexpat) and frame #1 (ld-linux) are unwinding artifacts past exit(), which never returns. expat is not involved — don't go chasing it.

The new bit: removing the poll did not end the dumps

The comment on #11058 concluded "#10951 removes that poll, so these dumps stop." On this machine they don't:

  • The 2 s battery poll really is gone — no user timers, no battery service unit, nothing polling.
  • Yet there are 6 dumps since #10951 closed (2026-10-12):
Time (CDT) PID Signal
2026-10-12 15:07:47 137466 SIGSEGV
2026-10-13 07:25:08 246948 SIGABRT
2026-10-13 18:15:37 59168 SIGSEGV
2026-10-13 20:52:47 89483 SIGABRT
2026-10-16 19:23:33 172414 SIGSEGV
2026-10-17 07:32:56 213764 SIGSEGV

30 dumps total since 2026-09-20 (19 SIGSEGV, 11 SIGABRT) — consistent with this being one teardown race that lands on the fatal path or the plain fault depending on timing.

Surviving trigger: the shell menu

With the poll gone, the only remaining caller is the Quickshell menu provider:

shell/plugins/menu/Menu.qml:277
  script: "current=$(powerprofilesctl get 2>/dev/null); omarchy-powerprofiles-list 2>/dev/null | ..."

It runs when the power-profiles submenu is loaded (Menu.qml:699, :811) and again on every rebuildItemsFromSources(), which resets providersLoaded (:249). So every menu open that rebuilds the source list is another roll of the dice. The 2>/dev/null swallows the crash, which is why this is easy to miss.

(I established this by elimination — this is the sole remaining invocation path in the shell and in omarchy-powerprofiles-* — rather than by capturing a crashing process's PPID, since coredumpctl doesn't record it and I couldn't reproduce it on demand: 500 consecutive runs, including 200 through the menu's exact bash -lc invocation, all exited 0. It's a narrow teardown race.)

The suggested fix is already half-landed

omarchy-powerprofiles-list --active-state returns the active profile from powerprofilesctl list without spawning powerprofilesctl get at all — the replacement proposed in the comment above exists and works. Menu.qml:277 just doesn't use it yet. Pointing current= at it should close this off.

Environment

  • Omarchy dev (3ce189e3)
  • power-profiles-daemon 0.30-1 — active, enabled, healthy
  • python 3.14.7-1, python-gobject 3.56.3-1, glib2 2.88.3-1
  • Kernel 7.2.9-arch1-Watanare-T2-4-t2
  • MacBookPro16,1 (T2) — Intel UHD 630 + Radeon RX 5500M hybrid graphics
  • Not OOM: 16 GiB free, 62 GiB swap unused, no oom-kill entries. No python/gobject/glib2 upgrade near the first crash.

Filed by Space Bunny Free via OpenCode.

joshpavlovich avatar Oct 17 '26 12:10 joshpavlovich

Thanks for the new cores, @joshpavlovich. I re-read current quattro (cce8b1c) against them. This was a source review on the coordinator and nothing ran on a worker, because the race does not trigger on demand, which matches your 500 clean runs.

Your finding holds. Taking the battery poll off the CLI did not take Omarchy off it. On quattro, powerprofilesctl is still started by the menu's power-profile provider (shell/plugins/menu/Menu.qml:328, get and then list through the helper), by bin/omarchy-powerprofiles-list:11 (list; the power panel runs it when it opens, every 5 s while it is open, and after each selection), and by bin/omarchy-powerprofiles-set (list and then set, at session start, on every AC/battery change and on each selection).

One correction. Pointing the menu's current= at omarchy-powerprofiles-list --active-state would not close this off. On quattro that helper is itself powerprofilesctl list (bin/omarchy-powerprofiles-list:11), so the menu would start the Python CLI once instead of twice. It would still crash at the same rate per spawn.

Where the fixes stand. #12552 (head 09e23c8) still reads Profiles/ActiveProfile and sets ActiveProfile over busctl in all three places. At that head no Omarchy code starts powerprofilesctl, so it removes the exposure whether the daemon is running or masked. #8712 still only skips the CLI when the daemon is inactive, which does nothing for the active-daemon crashes in every report since the first. #14737 changes which package provides the daemon and drops the shebang rewrite, but the CLI it ships is still the same PyGObject script, so it does not affect this crash. I have not linked #12552 here. Choosing which pull request carries the fix is the maintainer's call, and this run had no second opinion to check that link against.

Second opinion. None this run. The configured reviewer (Codex Medium) answered a ping, but the review was refused because the day's review budget was spent. Everything above is one model's reading of the source.

Next. This still waits on the maintainer to choose between #12552 and #8712.

omarchybot avatar Oct 17 '26 12:10 omarchybot

Still present on Omarchy 4.5.0-3 with newer versions than earlier reports in this thread, and on aarch64 through the set path, which has a side effect I don't see mentioned here.

Environment

  • Apple Silicon MacBook (aarch64), kernel 7.2.11-14-1-ARCH
  • omarchy-power-profiles-daemon 0.30-3, active and enabled
  • python 3.14.8-1, python-gobject 3.58.1-1, glib2 2.90.1-1

Crashes

Four SIGABRTs since Nov 5, all with the gdbus worker aborting from PyGILState_Ensure:

Time (PST) PID Command
2026-11-05 13:56:41 38890 powerprofilesctl set power-saver
2026-11-05 13:56:57 39961 powerprofilesctl set power-saver
2026-11-05 13:56:58 40100 powerprofilesctl set power-saver
2026-11-09 08:44:42 12061 powerprofilesctl set performance

Stack from PID 12061. Frames are unsymbolized because debuginfod returned nothing for these aarch64 libraries:

Crashing thread (gdbus):
#2  abort (libc.so.6 + 0x22630)
#4  _Py_FatalErrorFunc (libpython3.14.so.1.0 + 0x340b60)
#6  PyGILState_Ensure (libpython3.14.so.1.0 + 0x3463a8)
#7  n/a (_gi.cpython-314-aarch64-linux-gnu.so + 0x16498)
#8  n/a (libglib-2.0.so.0 + 0x3f640)
#9  g_object_unref (libgobject-2.0.so.0 + 0x22950)
#15 g_main_loop_run (libglib-2.0.so.0 + 0x6c02c)

Main thread, already past main():
#0  n/a (libX11.so.6 + 0x1b4ec)
#4  exit (libc.so.6 + 0x3a54c)
#6  __libc_start_main (libc.so.6 + 0x22ef8)

Side effect on the set path

From reading omarchy-powerprofiles-set:

powerprofilesctl set "$profile" || exit
omarchy-shell -q battery refreshPowerProfile >/dev/null 2>&1 || true

if [[ -n $requested_profile ]]; then
  mkdir -p "$state_dir"
  printf '%s\n' "$requested_profile" >"$state_file"
fi

The race happens during interpreter shutdown, after the CLI's work is done, but the abort still gives a non-zero status. || exit then skips the shell refresh and, for an explicitly requested profile, skips saving that profile for AC or battery. So this race can cost more than a core dump: a user's profile choice may be silently forgotten. I found this by reading the script and haven't confirmed it from a failed save.

skuthus avatar Nov 09 '26 16:11 skuthus

@skuthus, the possible lost preference follows the current helper's control flow. On quattro (c6be7abb9), bin/omarchy-powerprofiles-set:58 exits on a failed CLI status before reaching the preference write at lines 61–63. That write happens only for an explicitly selected profile, rather than an automatic AC/battery switch. On a disposable Omarchy ISO worker, I simulated a set that applies its change and then receives SIGABRT: the real helper exited 134 and kept the previous saved preference, or created no preference if there was none. This held for both AC and battery. A normal successful set saved the choice. This checks the conditional failure; it does not reproduce the Python race or establish that any of your aborted commands actually applied a profile and lost its saved choice.

The helper also skips its explicit refresh request. The panel refreshes itself after its action exits, and AC/battery changes have their own battery-service refresh. This check did not establish any display failure during your crashes.

#12552 is now linked to this issue. At c7d84acd279cf3de3383c076fc79b243a551f2b1, it replaces the list/set/menu CLI calls with D-Bus calls. In the same controlled check, its helpers saved the requested profile and refreshed without invoking the Python CLI; running the base scripts again repeated the failure. This does not verify the real daemon, authorization or Apple hardware. Genuine daemon rejections must still prevent saving a selection.

One limit to the earlier assessment: a newer Snapdragon CPU-floor service still invokes powerprofilesctl get (bin/omarchy-powerprofiles-floor:49). #12552 does not remove that caller. Its installer and migrations are gated to Qualcomm hardware, so that service does not explain the reported Apple set-path aborts.

GPT-6 in Codex (effort setting not exposed) checked the source and ran the controlled worker check. Opus 5.5 High and muse-wonder (via pi, thinking high) reviewed the source and results. Both agreed with the conditional save failure and the existing PR covering the reported paths; their independence from this session’s notes is not guaranteed.

This stays open while #12552 awaits its description update and passing CI, then the maintainer’s decision, including the remaining caller’s scope. No competing fix was opened.

omarchybot avatar Nov 18 '26 02:11 omarchybot