Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 540456 - app-misc/tmux-1.9a with dev-libs/libevent-2.1.5 - fails to collect the exit status of the shells of closed panes
Summary: app-misc/tmux-1.9a with dev-libs/libevent-2.1.5 - fails to collect the exit s...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Shell Tools project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-18 09:50 UTC by Tobias Klausmann (RETIRED)
Modified: 2015-10-15 08:12 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Klausmann (RETIRED) gentoo-dev 2015-02-18 09:50:59 UTC
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.
Comment 1 Nicolas Porcel 2015-02-20 00:45:57 UTC
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.
Comment 2 Antoine DECHAUME 2015-08-20 11:47:27 UTC
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.
Comment 3 Tobias Klausmann (RETIRED) gentoo-dev 2015-10-06 16:27:35 UTC
I have added a blocker against >=libevent-2.5.1 to tmux-1.9a and 2.0-r1 for now.
Comment 4 Patrice Clement gentoo-dev 2015-10-06 16:32:03 UTC
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.
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2015-10-12 04:16:47 UTC
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.
Comment 6 Tobias Klausmann (RETIRED) gentoo-dev 2015-10-14 10:39:49 UTC
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?
Comment 7 Tobias Klausmann (RETIRED) gentoo-dev 2015-10-15 08:12:29 UTC
Added the patch to libevent (with a revbump) and updated tmux's deps (with a revbump).