Skip to content

feat(spawning): make niri spawning work better with PR_SET_PDEATHSIG#3482

Open
nagisa wants to merge 1 commit intoniri-wm:mainfrom
nagisa:spawning
Open

feat(spawning): make niri spawning work better with PR_SET_PDEATHSIG#3482
nagisa wants to merge 1 commit intoniri-wm:mainfrom
nagisa:spawning

Conversation

@nagisa
Copy link
Contributor

@nagisa nagisa commented Feb 20, 2026

PR_SET_PDEATHSIG as commonly used by bubblewrap (--die-with-parent) which nixos in turn uses to wrap steam and heroic appears to keep track not only of the reaper process but also the thread that spawned the command.

This is extremely unfortunate, but this seems reasonably straightforward to make better on niri side. I quickly whipped this up and confirmed that niri with this change now can spawn steam or heroic on my system.

Having just one thread with a channel may also be ever-so-slightly faster compared to creating a full thread on every command invocation, but it has required me to pick a concrete type to represent the commands. If we want to support arbitrary OsStrings, that's also possible, although it would require reallocation of the command strings for every non-initial command.

@nagisa
Copy link
Contributor Author

nagisa commented Feb 20, 2026

@es-sai-fi

This comment was marked as resolved.

@nagisa
Copy link
Contributor Author

nagisa commented Feb 21, 2026

Huh, thanks for testing. Surprising that there are any cases where 32k stack wouldn't be enough 👀

I bumped the stack up to 96k, I would be ultra surprised if that wasn't enough to do all the spawning stuff...

`PR_SET_PDEATHSIG` as commonly used by bubblewrap (`--die-with-parent`)
which niri in turn uses to wrap `steam` and `heroic` appears to keep
track not only of the reaper process but also the thread that spawned
the command.

This is extremely unfortunate, but this seems reasonably straightforward
to make better on `niri` side. I quickly whipped this up and confirmed
that niri with this change now can spawn `steam` or `heroic` on my
system.

This may also be ever-so-slightly faster compared to creating a full
thread on every command invocation.
@Viruzaum
Copy link

It doesn't crash now, but it still doesn't spawn heroic and steam 100% of the time.

@es-sai-fi
Copy link

es-sai-fi commented Feb 21, 2026

Tested with Helium (has the same problem) and Heroic, both still experiencing it 🤔

@nagisa
Copy link
Contributor Author

nagisa commented Feb 22, 2026

Hmm, alright, I don't think I will be able to investigate it for longer, but just to make sure, both of you are testing

niri msg action spawn -- steam/heroic/helium??

@es-sai-fi
Copy link

es-sai-fi commented Feb 22, 2026

Hmm, alright, I don't think I will be able to investigate it for longer, but just to make sure, both of you are testing

niri msg action spawn -- steam/heroic/helium??

I tested with keybinds at first but went back and tested like this and yep still doesn't work :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants