Skip to content

fix: prevent wallpaper daemon race on concurrent starts - #97

Merged
dwilliam62 merged 1 commit into
LinuxBeginnings:developmentfrom
hyperion-ak:fix/wallpaper-daemon-race
Aug 31, 2026
Merged

fix: prevent wallpaper daemon race on concurrent starts#97
dwilliam62 merged 1 commit into
LinuxBeginnings:developmentfrom
hyperion-ak:fix/wallpaper-daemon-race

Conversation

@hyperion-ak

Copy link
Copy Markdown
Contributor

Description

Startup_Apps.conf runs WallpaperDaemon.sh and ApplyThemeMode.sh ->
DarkLight.sh concurrently. Both start the wallpaper daemon, and all guards
are check-then-start (pgrep or query), which is not atomic. When both see
"not running", both spawn a daemon and the loser aborts:

thread '<unnamed>' panicked at daemon/src/main.rs:717:55:
called `Result::unwrap()` on an `Err` value:
"There is an awww-daemon instance already running on this socket!"

One daemon survives, so the desktop works and this is easy to miss, but it
leaves a SIGABRT core dump on every affected login.

Adds wallpaper_ensure_daemon() to WallpaperCmd.sh (already sourced by all
wallpaper scripts) and uses it in the four callers. It holds an flock across
check and start. The daemon gets 9>&- so it does not inherit the lock fd and
hold the lock for its lifetime. Without flock the old behaviour is kept.

Note: WallpaperSelect.sh loses its echo "Starting ..." line and its
readiness wait goes 20 -> 50, matching the other callers.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (non-breaking change; modified files are limited to the documentations)
  • Technical debt (a code change that does not fix a bug or add a feature but makes something clearer for devs)
  • Other (provide details below)

Checklist

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My commit message follows the commit guidelines.
  • My change requires a change to the documentation.
  • I want to add something in Hyprland-Dots wiki.
  • I have added tests to cover my changes.
  • I have tested my code locally and it works as expected.
  • All new and existing tests passed.

Additional context

Arch, Hyprland 0.56.2, awww 0.12.1-1, Hyprland-Dots-v2.3.25

Checking with "query" or "pgrep" and then starting the daemon is not
atomic. Two callers can both see "not running" and both spawn a daemon.
The loser panics and aborts with SIGABRT, leaving a core dump behind:

  thread '<unnamed>' panicked at daemon/src/main.rs:717:55:
  called `Result::unwrap()` on an `Err` value: "There is an
  awww-daemon instance already running on this socket!"

This triggers on a normal login, where Startup_Apps.conf runs
WallpaperDaemon.sh and ApplyThemeMode.sh -> DarkLight.sh concurrently.

Add a shared wallpaper_ensure_daemon() to WallpaperCmd.sh that holds an
flock while it checks and starts, and use it in the four callers. The
daemon does not inherit the lock descriptor, so the lock is released as
soon as the daemon is ready. Without flock the previous behaviour is
kept, so no new hard dependency is introduced.
@dwilliam62 dwilliam62 self-assigned this Aug 31, 2026
@dwilliam62 dwilliam62 added the enhancement New feature or request label Aug 31, 2026
@dwilliam62
dwilliam62 deleted the branch LinuxBeginnings:development August 31, 2026 19:38
@dwilliam62 dwilliam62 closed this Aug 31, 2026
@dwilliam62 dwilliam62 reopened this Aug 31, 2026
@dwilliam62

Copy link
Copy Markdown
Contributor

Thanks for this!

Regards,
Don

@dwilliam62
dwilliam62 merged commit a61f89d into LinuxBeginnings:development Aug 31, 2026
dwilliam62 added a commit that referenced this pull request Aug 31, 2026
* Updated version to v2.3.26.1

Signed-off-by: Don Williams <don.e.williams@gmail.com>

 On branch development
 Changes to be committed:
	modified:   CHANGELOG.md
	modified:   config/hypr/configs/ENVariables.conf
	modified:   config/hypr/lua/env.lua

* Merge pull request #97 from hyperion-ak/fix/wallpaper-daemon-race

fix: prevent wallpaper daemon race on concurrent starts

* remove: unused code (#93)

* Updated CHANGELOG

Signed-off-by: Don Williams <don.e.williams@gmail.com>

* Fixed duplicate waybar on ZorinOS

Signed-off-by: Don Williams <don.e.williams@gmail.com>

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   config/hypr/scripts/WaybarStartup.sh
	modified:   copy.sh

* Fixed waybar restore (again) on upgrades

Signed-off-by: Don Williams <don.e.williams@gmail.com>

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   copy.sh
	modified:   scripts/lib_copy.sh

* Updated CHANGELOG

Signed-off-by: Don Williams <don.e.williams@gmail.com>

---------

Signed-off-by: Don Williams <don.e.williams@gmail.com>
Co-authored-by: hyperion-ak <9286384+hyperion-ak@users.noreply.github.com>
Co-authored-by: silesai <silesai@proton.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants