Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmux leaves zombies around #311

Closed
ghost opened this issue Feb 17, 2016 · 6 comments
Closed

tmux leaves zombies around #311

ghost opened this issue Feb 17, 2016 · 6 comments

Comments

@ghost
Copy link

ghost commented Feb 17, 2016

Reproducer
$ tmux new-window true&;exec true; sleep 1; ps x | grep -c [d]efunct; pkill -CHLD tmux; ps x | grep -c [d]efunct
1
0

@nicm
Copy link
Member

nicm commented Feb 17, 2016

This is a side effect of using libutempter which puts in its own SIGCHLD handler; if the tmux child exits while utempter has its handler in, tmux will never get the SIGCHLD.

@ghost
Copy link
Author

ghost commented Feb 17, 2016

Nicholas Marriott notifications@github.com writes:

This is a side effect of using libutempter which puts in its own
SIGCHLD handler; if the tmux child exits while utempter has its
handler in, tmux will never get the SIGCHLD.

I do the above (more or less) in a script, my best bet, it seems it to
do a:
trap 'pkill -CHLD tmux' 0
or is there a better way?

mailto:moosotc@gmail.com

@nicm
Copy link
Member

nicm commented Feb 17, 2016

You can try this

diff --git a/window.c b/window.c
index a89b108..7a74afb 100644
--- a/window.c
+++ b/window.c
@@ -915,6 +915,7 @@ window_pane_spawn(struct window_pane _wp, int argc, char *_argv,
#ifdef HAVE_UTEMPTER
xsnprintf(s, sizeof s, "tmux(%lu).%%%u", (long) getpid(), wp->id);
utempter_add_record(wp->fd, s);

  • kill(getpid(), SIGCHLD);
    #endif

    setblocking(wp->fd, 0);

On Wed, Feb 17, 2016 at 06:41:04AM -0800, moosotc wrote:

Nicholas Marriott notifications@github.com writes:

This is a side effect of using libutempter which puts in its own
SIGCHLD handler; if the tmux child exits while utempter has its
handler in, tmux will never get the SIGCHLD.

I do the above (more or less) in a script, my best bet, it seems it to
do a:
trap 'pkill -CHLD tmux' 0
or is there a better way?

--
mailto:moosotc@gmail.com

--
Reply to this email directly or [1]view it on GitHub.

Reverse link: [2]unknown

References

Visible links

  1. tmux leaves zombies around #311 (comment)
  2. tmux leaves zombies around #311 (comment)

@ghost
Copy link
Author

ghost commented Feb 17, 2016

Nicholas Marriott notifications@github.com writes:

You can try this

diff --git a/window.c b/window.c
index a89b108..7a74afb 100644
--- a/window.c
+++ b/window.c
@@ -915,6 +915,7 @@ window_pane_spawn(struct window_pane _wp, int argc, char *_argv,
#ifdef HAVE_UTEMPTER
xsnprintf(s, sizeof s, "tmux(%lu).%%%u", (long) getpid(), wp->id);
utempter_add_record(wp->fd, s);

  • kill(getpid(), SIGCHLD);
    #endif

    setblocking(wp->fd, 0);

[..snip..]

Thank you. Think I'll stick with trap then; before the number of locally
modified (i.e. non distro/vanilla packages) grows out of proportion.

mailto:moosotc@gmail.com

@nicm
Copy link
Member

nicm commented Feb 17, 2016

Applied this anyway.

@lock
Copy link

lock bot commented Feb 16, 2020

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

@lock lock bot locked and limited conversation to collaborators Feb 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant