[PR #1296] [MERGED] Fix reaper deadlock #1307

Closed
opened 2026-01-05 14:54:50 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/LGUG2Z/komorebi/pull/1296
Author: @alex-ds13
Created: 2/24/2025
Status: Merged
Merged: 2/24/2025
Merged by: @LGUG2Z

Base: masterHead: fix/reaper-deadlock


📝 Commits (1)

  • 04fdcc1 fix(reaper): fix reaper deadlock at startup

📊 Changes

2 files changed (+20 additions, -17 deletions)

View changed files

📝 komorebi/src/main.rs (+13 -13)
📝 komorebi/src/reaper.rs (+7 -4)

📄 Description

Previously the reaper at startup would lock it's own HWNDS_CACHE and then try to lock the WM to get its known_hwnds, however if there was an event in the mean time, the process_event would lock the WM first and then it would try to lock the reaper's HWNDS_CACHE to update it but it would deadlock since that would be locked by the reaper waiting for the WM to be released.

This PR now makes it so we pass the known_hwnds to the reaper as an argument at startup and it also rearranges the order of loading the listeners. Now it first loads all the manager type listeners and only after it does it load the commands and events listeners. After some testing this seems to be the best order that doesn't cause any issues at all! There were some other issues that I've noticed before when starting komorebi while having other 3rd parties trying to subscribe to it (like komorebi-bar and YASB) which would make those subscribers lock the process_command thread. This doesn't seem to be happening on my tests anymore with this new order.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/LGUG2Z/komorebi/pull/1296 **Author:** [@alex-ds13](https://github.com/alex-ds13) **Created:** 2/24/2025 **Status:** ✅ Merged **Merged:** 2/24/2025 **Merged by:** [@LGUG2Z](https://github.com/LGUG2Z) **Base:** `master` ← **Head:** `fix/reaper-deadlock` --- ### 📝 Commits (1) - [`04fdcc1`](https://github.com/LGUG2Z/komorebi/commit/04fdcc13b82675d3e576009d0b66af066b3f9eb1) fix(reaper): fix reaper deadlock at startup ### 📊 Changes **2 files changed** (+20 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `komorebi/src/main.rs` (+13 -13) 📝 `komorebi/src/reaper.rs` (+7 -4) </details> ### 📄 Description Previously the reaper at startup would lock it's own `HWNDS_CACHE` and then try to lock the WM to get its `known_hwnds`, however if there was an event in the mean time, the process_event would lock the WM first and then it would try to lock the reaper's `HWNDS_CACHE` to update it but it would deadlock since that would be locked by the reaper waiting for the WM to be released. This PR now makes it so we pass the `known_hwnds` to the reaper as an argument at startup and it also rearranges the order of loading the listeners. Now it first loads all the manager type listeners and only after it does it load the commands and events listeners. After some testing this seems to be the best order that doesn't cause any issues at all! There were some other issues that I've noticed before when starting komorebi while having other 3rd parties trying to subscribe to it (like komorebi-bar and YASB) which would make those subscribers lock the `process_command` thread. This doesn't seem to be happening on my tests anymore with this new order. <!-- Please follow the Conventional Commits specification. If you need to update your PR with changes from `master`, please run `git rebase master`. By opening this PR, you confirm that you have read and understood this project's `CONTRIBUTING.md`. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-01-05 14:54:50 +01:00
adam closed this issue 2026-01-05 14:54:50 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#1307