When using tmux-1.9a compiled against libevent-2.1.5, tmux reproducibly fails to collect the exit status of the shells of closed panes, leading to Zombies: 56970 ? Ss 0:00 tmux new-session -s irssi irssi 56971 pts/1 Ssl+ 0:00 \_ irssi 57174 ? Zs 0:00 \_ [bash] <defunct> 57479 ? Zs 0:00 \_ [bash] <defunct> 58448 ? Zs 0:00 \_ [bash] <defunct> 58498 pts/6 Ss 0:00 \_ -bash 62711 pts/6 R+ 0:00 | \_ ps axf 58517 ? Zs 0:00 \_ [bash] <defunct> Backdating libevent to 2.0.22 and recompiling tmux fixes this behaviour. I am not sure if this is a bug in libevent or if tmux is using it the wrong way. The tmux SF page is down atm, so I can't check if this is a known issue.
I have a related problem. When using the if-shell command in tmux.conf with libevent-2.1.5, my tmux hangs and doesn't start. I have to kill the process in order to get the control back. Downgrading libevent to 2.0.22 fixes the problem. The problem in tmux is from job.c:job_callback() (line 157). When executed, it will call bufferevent_disable and set the job fd to 0. Then the process will die, calling job.c:job_died(), entering the condition job->fd == -1 and calling the callback that will execute the code of the if-shell function in tmux.conf (the if or the else depending on the return status). This can be verified by putting this line in your tmux.conf and run tmux -v (I can attach the log file if needed): if-shell false 'false' I think this problem is due to libevent hanging in multihread environment, reported in this thread: http://archives.seul.org/libevent/users/Feb-2012/msg00053.html. You may also be interested in reading the changelog from libevent 2.1 available here: https://github.com/libevent/libevent/blob/master/whatsnew-2.1.txt, section 1.3.1. Can anyone confirm this information? If they are true, nothing can be don except to wait for a patch of libevent, which might be coming with the stable version.
I asked tmux mailing list and its dev confirmed the issue with libevent 2.1, see https://groups.google.com/d/msg/tmux-users/fTJCwcSEwvw/Rbmwyt1dBAAJ.
I have added a blocker against >=libevent-2.5.1 to tmux-1.9a and 2.0-r1 for now.
I think we can call it a day for the time being until upstream deal with the issue and come up with a patch. Please reopen/revisit this bug once it's been officially fixed.
Let's close this bug when it's been officially fixed. Closed bugs are nearly invisible and the upward blocker causes issues of its own.
There is a patch here: http://sourceforge.net/p/levent/bugs/350/ I tried it ontop of 2.1.5-r3 and the Zombie problem went away. Given that the patch has been rotting in the bug tracker over there for half a year, I think we should just include it in a to-be-made -r4 and adjust the tmux deps accordingly. @jer: any objections to me doing just that?
Added the patch to libevent (with a revbump) and updated tmux's deps (with a revbump).