Skip to content

Add support for spawning panes in separate cgroups#3514

Closed
yut23 wants to merge 3 commits intotmux:masterfrom
yut23:systemd_cgroup_support
Closed

Add support for spawning panes in separate cgroups#3514
yut23 wants to merge 3 commits intotmux:masterfrom
yut23:systemd_cgroup_support

Conversation

@yut23
Copy link
Copy Markdown

@yut23 yut23 commented Mar 30, 2023

This PR moves newly-spawned panes into their own cgroups via transient systemd transient scopes, as discussed in #3024 and #3183. It uses the dbus API provided by libsystemd, so no new libraries are needed.

Some questions that need to be addressed before merging:

  • When should this be enabled: always, with a build flag, or with a server option?
  • What should we do if the call fails? (by default, VTE just prints a debug message and continues as normal)
  • If the child process exits before the dbus call goes through, the call will still succeed, but the unit will fail and won't be cleaned up by systemd. VTE avoids this by including a drop-in config file that says to remove the unit even if it fails (CollectMode=inactive-or-failed in /usr/lib/systemd/user/vte-spawn-.scope.d/defaults.conf). We could set that option directly in the dbus call, but putting it in a config file lets the end users/packagers override it if they want to inspect any errors. Do we want to include such a file with tmux?

@nicm
Copy link
Copy Markdown
Member

nicm commented Mar 30, 2023

This looks fine, thanks.

Not a fan of shipping extra config files.

I'd just turn it on by default if it's something most people are likely to want. Or add a configure flag. I don't think it needs runtime config.

yut23 added 2 commits March 30, 2023 17:27
This can occur if the child process exits before the dbus call in the
parent finishes, in which case the cgroup is unneeded.
@nicm
Copy link
Copy Markdown
Member

nicm commented Apr 3, 2023

I can't confirm if the systemd bits work but it all looks good to me. Applied now with one minor fix (free *cause in spawn.c on failure) and some minor style nits (spacing and tidy comments). Thanks!

@nicm nicm closed this Apr 3, 2023
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2023

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants