I found an fd leak recently; it is not specific to jobs, but attempting to
use a version-mismatched tmux client from run-shell or if-shell might
create a situation like this.
The "identify" message(s) sent by the client pass their stdin (and cwd in
the latest commits). The server automatically accepts the fds, but in the
case of a mismatched protocol version the fd will never be closed.
Doing something like this when sending MSG_VERSION fixes this particular
leak:
if (imsg.fd != -1) close(imsg.fd);
Usually a client would have a tty for the stdin that it passes, but it
would have a socket if it was started under run-shell or if-shell (or
possibly other contexts that are not specific to tmux).
Jan, have you ever noticed a message like the following when you use the
bindings that use tmux inside run-shell?
protocol version mismatch (client 7, server 8)
--
Chris
On Thu, Oct 10, 2013 at 3:21 AM, Nicholas Marriott <
nicholas.marri...@gmail.com> wrote:
>
> Hmm have you got 6 clients attached?
>
> All the sockets must be the stdin/stdout/stderr from the jobs.
>
> What libevent version did you build tmux against?
>
> Can you run tmux -Lxyz -vvvv for long enough for your status line to
> update a few times (a couple of minutes would probably do) and then send
> me the server log?
>
>
>
> On Thu, Oct 10, 2013 at 01:32:22PM +1300, Jan Larres wrote:
> > On 02/10/13 11:51, Nicholas Marriott wrote:
> > > Ok I'm back and can take a better look at this...
> >
> > I'm back now too and can do more experimenting.
> >
> > > Are you sure they are not still there even as zombies?
> >
> > Yes, they're really gone. Assuming I can trust the output of ps, that
is.
> >
> > > What was the outcome of killing all the panes but one once it starts
> > > getting slow? Does it fix it?
> >
> > I don't think it made a real difference, but at the moment I can't test
> > it due to some interesting behaviour in my test server instance that I
> > left running for the last two weeks. The program call in the statusline
> > doesn't seem to get executed any more, and if I try to open a new window
> > I get this message:
> >
> > Create window failed: zsh -l: Too many open files
> >
> > And indeed, looking at the lsof output there are a lot of sockets open:
> >
> > $ lsof -p 6684
> > COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE
NAME
> > tmux 6684 jan cwd DIR 8,2 12288 3145730
/home/user/jan
> > tmux 6684 jan rtd DIR 8,2 4096 2 /
> > tmux 6684 jan txt REG 8,2 2184674 3694724
/home/user/jan/src/tmux/tmux
> > tmux 6684 jan mem REG 8,2 131593 35127321
/lib/x86_64-linux-gnu/libpthread-2.17.so
> > tmux 6684 jan mem REG 8,2 14664 35127362
/lib/x86_64-linux-gnu/libdl-2.17.so
> > tmux 6684 jan mem REG 8,2 1742520 35127343
/lib/x86_64-linux-gnu/libc-2.17.so
> > tmux 6684 jan mem REG 8,2 84856 35127644
/lib/x86_64-linux-gnu/libresolv-2.17.so
> > tmux 6684 jan mem REG 8,2 289168 23113902
/usr/lib/x86_64-linux-gnu/libevent-2.0.so.5.1.9
> > tmux 6684 jan mem REG 8,2 167608 35127670
/lib/x86_64-linux-gnu/libtinfo.so.5.9
> > tmux 6684 jan mem REG 8,2 138808 35127671
/lib/x86_64-linux-gnu/libncurses.so.5.9
> > tmux 6684 jan mem REG 8,2 10680 35127649
/lib/x86_64-linux-gnu/libutil-2.17.so
> > tmux 6684 jan mem REG 8,2 145160 35127324
/lib/x86_64-linux-gnu/ld-2.17.so
> > tmux 6684 jan mem REG 8,2 217032 12321002
/var/cache/nscd/group
> > tmux 6684 jan mem REG 8,2 1607600 23074462
/usr/lib/locale/locale-archive
> > tmux 6684 jan 0u CHR 1,3 0t0 2052
/dev/null
> > tmux 6684 jan 1u CHR 1,3 0t0 2052
/dev/null
> > tmux 6684 jan 2u CHR 1,3 0t0 2052
/dev/null
> > tmux 6684 jan 3u 0000 0,9 0 4405
anon_inode
> > tmux 6684 jan 4u unix 0xffff88019f4b2800 0t0 2718632052
socket
> > tmux 6684 jan 5u unix 0xffff8802106cf400 0t0 2718632053
socket
> > tmux 6684 jan 6u CHR 136,25 0t0 28
/dev/pts/25
> > tmux 6684 jan 7u unix 0xffff8802106ce3c0 0t0 2718632065
/tmp/tmux-1179/foo
> > tmux 6684 jan 8u unix 0xffff88019f4b2b40 0t0 2718632051
socket
> > tmux 6684 jan 9u CHR 5,2 0t0 3
/dev/ptmx
> > tmux 6684 jan 10u CHR 5,2 0t0 3
/dev/ptmx
> > tmux 6684 jan 11u CHR 5,2 0t0 3
/dev/ptmx
> > tmux 6684 jan 12u unix 0xffff8801101841c0 0t0 2718658801
/tmp/tmux-1179/foo
> > tmux 6684 jan 13u CHR 136,44 0t0 47
/dev/pts/44
> > tmux 6684 jan 14u CHR 5,2 0t0 3
/dev/ptmx
> > tmux 6684 jan 15u unix 0xffff880212ab7780 0t0 2718661229
/tmp/tmux-1179/foo
> > tmux 6684 jan 16u CHR 136,46 0t0 49
/dev/pts/46
> > tmux 6684 jan 17u CHR 5,2 0t0 3
/dev/ptmx
> > tmux 6684 jan 18u unix 0xffff88011099c280 0t0 2764091289
/tmp/tmux-1179/foo
> > tmux 6684 jan 19u CHR 136,48 0t0 51
/dev/pts/48
> > tmux 6684 jan 20u CHR 5,2 0t0 3
/dev/ptmx
> > tmux 6684 jan 21u unix 0xffff88003997d780 0t0 2718680652
/tmp/tmux-1179/foo
> > tmux 6684 jan 22u CHR 136,50 0t0 53
/dev/pts/50
> > tmux 6684 jan 23u CHR 5,2 0t0 3
/dev/ptmx
> > tmux 6684 jan 24u unix 0xffff880110184840 0t0 2718688142
/tmp/tmux-1179/foo
> > tmux 6684 jan 25u CHR 136,52 0t0 55
/dev/pts/52
> > tmux 6684 jan 26u CHR 5,2 0t0 3
/dev/ptmx
> > tmux 6684 jan 27u unix 0xffff8800371ac440 0t0 1266248685
socket
> > tmux 6684 jan 28u unix 0xffff8802131b7b80 0t0 1266248686
socket
> > tmux 6684 jan 29u unix 0xffff880115639540 0t0 1266289585
socket
> > tmux 6684 jan 30u unix 0xffff88010c404440 0t0 329379488
socket
> > tmux 6684 jan 31u unix 0xffff88010c4057c0 0t0 329379489
socket
> > tmux 6684 jan 32u unix 0xffff8800aac99900 0t0 329379490
socket
> > tmux 6684 jan 33u unix 0xffff8800aac98580 0t0 329379491
socket
> > tmux 6684 jan 34u CHR 5,2 0t0 3
/dev/ptmx
> > tmux 6684 jan 35u CHR 5,2 0t0 3
/dev/ptmx
> > tmux 6684 jan 36u CHR 5,2 0t0 3
/dev/ptmx
> > tmux 6684 jan 38u CHR 5,2 0t0 3
/dev/ptmx
> > tmux 6684 jan 39u unix 0xffff880115638840 0t0 1266289586
socket
> > tmux 6684 jan 40u unix 0xffff88004f6ce3c0 0t0 1266246944
socket
> > tmux 6684 jan 41u unix 0xffff880213477880 0t0 329379492
socket
> > tmux 6684 jan 42u unix 0xffff8801fe9f6540 0t0 329379493
socket
> >
> > [...]
> >
> > tmux 6684 jan 1021u unix 0xffff880036f4f440 0t0 338483052
socket
> > tmux 6684 jan 1022u unix 0xffff880036f4f100 0t0 338483053
socket
> > tmux 6684 jan 1023u unix 0xffff880036f4edc0 0t0 338483054
socket
> >
> > After closing all windows/sessions but one and trying to open a new
> > window I curiously get:
> >
> > Create window failed: zsh -l: No such file or directory
> >
> > and creating a new session with 'tmux -L' just hangs.
> >
> > If I try to open a new window in my other, main server I get this:
> >
> > Create window failed: zsh -l: Cannot allocate memory
> >
> > > Also did you send your config before, if not can you send it now?
> >
> > My configuration is here:
> > https://github.com/majutsushi/etc/blob/master/tmux/tmux.conf
> >
> > But note that for my test server I have the right statusline configured
> > like so:
> >
> > set-option -g status-right "] <#(date)> #[fg=default,bold]#S
#[fg=default,default]%H:%M:%S"
> >
> > I'll update to latest Git and see if it changes anything, but judging
> > from the commit messages I kind of doubt it.
> >
> > Jan
> >
> >
> >
------------------------------------------------------------------------------
> > October Webinars: Code for Performance
> > Free Intel webinars can help you accelerate application performance.
> > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the
most from
> > the latest Intel processors and coprocessors. See abstracts and
register >
> >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
> > _______________________________________________
> > tmux-users mailing list
> > tmux-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/tmux-users
>
>
------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
from
> the latest Intel processors and coprocessors. See abstracts and register >
>
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users