omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Shell inherits ignored SIGCHLD from Hyprland: every Quickshell Process reports exitCode 0 / CrashExit

Open AmanKRoy opened this issue 1 month ago • 4 comments

System details

Intel Core Ultra laptop (Arc iGPU), dual monitor, Omarchy 4.0.6-1, Hyprland 0.56.2-4, quickshell 0.3.2.r7.g2b4501a-1, qt6-base 6.12.0-3, systemd 262.1

What's wrong?

The Omarchy shell is started with SIGCHLD ignored, inherited from Hyprland. In that state every Quickshell Process reports exitCode=0 exitStatus=1 (CrashExit) when it exits, whatever the child really returned. Anything in the shell that decides from onExited's exitCode gets the wrong answer.

Symptoms I hit

  • The ScreenRecording bar indicator is lit ("Stop recording") with no recorder running (#10311). Clicking it does nothing, since --stop-recording exits 1 with nothing to stop.
  • The capture menu lists "Stop Screenrecording" all the time. Its when: guard runs through guardProc in shell/plugins/menu/Menu.qml, which treats exitStatus != 0 as "the batch was killed" and keeps every row.
  • Other handlers that read exitCode in onExited (for example Reminder.qml, SystemUpdate.qml) are presumably affected too. I haven't checked them.

Evidence

  1. Logging both arguments in the indicator's onExited: exitCode=0 exitStatus=1 on every check. A ["false"] command logs the same, so it isn't specific to pgrep or to the helper script.
  2. The running shell has SigIgn: 0000000001011006 in /proc/<pid>/status. Bit 0x10000 is SIGCHLD. Hyprland's own status shows SigIgn: 0000000001011000, same bit. omarchy-launch-shell is started from Hyprland (hl.exec_cmd("omarchy-launch-shell") in autostart.lua, and hyprctl dispatch 'hl.dsp.exec_cmd("omarchy-launch-shell")' in omarchy-restart-shell).
  3. A chain with an ignoring parent, bash -c 'systemd-cat -t t -- sh -c "grep SigIgn /proc/self/status"', shows the final process with 0x1011006. So the ignore survives bash and systemd-cat into the shell.
  4. I launched the same shell from a session that does not ignore SIGCHLD (SigIgn: 0x1000, same quickshell -n -p /usr/share/omarchy/shell command). The icon was off when idle, and "Stop Screenrecording" appeared in the menu only while recording.
  5. Not reproduced: a standalone quickshell -p test.qml with a trivial config reports exits correctly (false gives code 1, exit 3 gives code 3) even when started by a parent that ignores SIGCHLD. So I can't say which part of the full shell, or which Quickshell/Qt version, needs it. I only know the real shell breaks and a clean launch doesn't.

Hyprland's reapZombieChildrenAutomatically() (src/main.cpp, v0.56.2) installs SIG_DFL with SA_NOCLDWAIT, which is the same mechanism behind the os.execute ECHILD problem analysed in #7755. I haven't checked how that ends up as an inherited SigIgn bit across exec; the /proc values above are what I observed.

When it started The same indicator patch gave correct exitCode=1 exitStatus=0 on 2026-10-15 (Omarchy 4.0.4, quickshell 0.3.1, Qt 6.11.2). The wrong values appeared after the 2026-10-19 upgrade batch (Qt 6.11.2 to 6.12.0, quickshell 0.3.1 to 0.3.2 then 0.3.2.r7, Hyprland 0.56.2-2 to -4, systemd 261 to 262). I haven't bisected which one matters.

Workaround that fixes both symptoms In omarchy-launch-shell, reset the disposition for the shell:

-    systemd-cat -t omarchy-shell -- quickshell -n -p "$OMARCHY_PATH/shell" &
+    systemd-cat -t omarchy-shell -- env --default-signal=CHLD quickshell -n -p "$OMARCHY_PATH/shell" &

After that the shell shows SigIgn: 0000000001001006, the icon is off when idle, lights during a recording, and clears on stop. The menu row appears only while recording.

Check on your machine

grep SigIgn /proc/$(pgrep -f '^quickshell -n -p /usr/share/omarchy/shell')/status

If the value has bit 0x10000 set (for example ...1011006), the shell has the inherited ignore.

Suggested fix Reset SIGCHLD in omarchy-launch-shell as above, or at the Hyprland spawn path. A periodic re-check in the indicator (#9296) wouldn't help here, since the exit values are wrong on every check.

AmanKRoy avatar Oct 31 '26 19:10 AmanKRoy

#17182, #17184 and #17302 make the same one-line change to bin/omarchy-launch-shell (env --default-signal=CHLD before quickshell), so only one needs to land. Reading the three against quattro (a69b19f64), I'd take #17302:

  • Its comment says the ignore comes from whatever started the shell. That matches omarchybot's stock install, where Hyprland doesn't pass an ignored SIGCHLD on (its SA_NOCLDWAIT is cleared at exec). #17182 and #17184 say Hyprland does.
  • Its test adds one case under env --ignore-signal=CHLD and leaves the helper the other launcher cases use unchanged; #17182 wraps all of them in an extra bash -c … exec.
  • It closes #10311 too, and omarchybot reports reproducing the bug and the fix on a VM.

@jasasonc opened the first fix two minutes after the report, and @AmanKRoy found the cause, wrote the workaround and opened #17184; both deserve co-author credit on whatever lands. One correction to #17184's note: the launcher test's bash stubs can see an inherited ignore, because bash passes an ignore it started with on to every command it runs. Both added tests rely on that.

I read the code and didn't run the tests. Where the reporter's ignore comes from is still open.

aholbreich avatar Nov 02 '26 10:11 aholbreich

Thanks for reading all three, and for the credit. I'm happy for #17302 to be the one that lands. I'll close #17184 once it does, or sooner if you'd rather.

Two follow-ups.

Tests: my note in #17184 was wrong. Bash does pass an ignored SIGCHLD on to its children. env --ignore-signal=CHLD bash -c 'env grep SigIgn /proc/self/status' prints 0000000000010000, while a plain bash -c prints zeros. So the bash stubs can see the ignore, and both added tests are valid.

Where the ignore comes from: on my machine the ignore is set inside the Hyprland process, not inherited from further up. SigIgn on the current boot (bit 0x10000 is SIGCHLD):

  • start-hyprland: 0000000001001000, clear
  • Hyprland: 0000000001011000, set
  • omarchy-launch-shell (a bash script, which handles SIGCHLD itself but passes the ignore to the children it starts): 0000000001001004

start-hyprland just does fork() and execvp("Hyprland") (start/src/core/Instance.cpp), with no SIGCHLD handling, so it isn't passing anything on. That also rules out the SA_NOCLDWAIT explanation. reapZombieChildrenAutomatically() in v0.56.2 calls sigaction(SIGCHLD) with SIG_DFL plus SA_NOCLDWAIT, and I tested exactly that in a small C program on this kernel (7.2.8): SigIgn does not show the SIGCHLD bit, and a child after exec has 0000000000000000. So that call is not what produces the SigIgn bit on the running compositor, which means my earlier guess in this issue that it was the mechanism was wrong too. The bit is there on the running Hyprland, but I haven't found which call sets it. A code search over hyprwm for SIG_IGN only finds signal(SIGPIPE, SIG_IGN).

I can't say whether the VM's start path differs. #17302's test sets the ignore explicitly, so it can't tell us either. If someone can run grep SigIgn /proc/$(pgrep -x Hyprland)/status on a stock install, that would settle it. If the bit is there too, the launcher reset is needed on stock installs as well.

AmanKRoy avatar Nov 02 '26 23:11 AmanKRoy

Update: root cause found and it is local, not Hyprland. In my case the SIG_IGN came from a third-party Hyprland plugin I run (it called signal(SIGCHLD, SIG_IGN) process-wide to avoid reaping spawned helpers). With the plugin fixed, SigIgn on Hyprland no longer has bit 0x10000, and Quickshell/wl-copy children behave normally. A nested Hyprland with no plugins also did not set it. So my earlier guess that Hyprland itself leaks the ignore was wrong.

If anyone sees grep SigIgn /proc/$(pgrep -x Hyprland)/status with 0x10000 set, check loaded plugins (hyprctl plugin list) first. The launcher-side reset in #17302 is still a reasonable guard, but this is not a Hyprland bug.

AmanKRoy avatar Nov 07 '26 17:11 AmanKRoy

Data point from a stock-ish install: on 4.5.0-3 / hyprland 0.56.2-4 / quickshell 0.3.2.r7, no Hyprland plugins loaded, Hyprland's SigIgn is 0000000001001000 and quickshell's is 0000000001001006. Bit 0x10000 is clear on both, so SIGCHLD isn't ignored here. That fits it coming from a plugin, as found above.

Somnius avatar Nov 14 '26 07:11 Somnius