Discussion:
[tmux:tickets] #196 tmux with many open panes hangs on OSX
Bruno Sutic
2015-05-24 12:04:32 UTC
Permalink
---

** [tickets:#196] tmux with many open panes hangs on OSX**

**Status:** open
**Created:** Sun May 24, 2015 12:04 PM UTC by Bruno Sutic
**Last Updated:** Sun May 24, 2015 12:04 PM UTC
**Owner:** nobody

Hi,
first of all, thanks for working on and maintaining this fantastic piece of software!

I've had issues with tmux for the past 2 months after upgrading from OSX 10.10.2 to 10.10.3.
When a certain number of panes was created, after a while (a minute or so) tmux would freeze and take 100% of a processor. The solution was to `kill -9` the process and start over.

I thought this is some kind of tmux bug, but after some investigation it turns out tmux was hitting the maximum number of open file descriptors. When this limit was increased, the problem didn't happen anymore.

To be specific:

- checking the maximum number of open file descriptors on OS X:
`ulimit -n` # => results with default 256
- the line that fixed the problem:
`echo 'ulimit -n 1024' | sudo tee -a /etc/profile`

Still, I'm opening this issue to check if the problem can be handled more gracefully?

Below are all the details I was able to collect during the investigation, while the problem was present.

- OSX 10.10.3
- tmux version: 2.1 (installed from git a day before reporting this issue)
- the script to reproduce the issue:
`for i in $(seq 1 150); do tmux new-window; done`
this would create only 120 panes (instead of expected 150) and generate error:
`create window failed: reattach-to-user-namespace -l /usr/local/bin/bash: Too many open files`
- OSX doesn't have `strace` so I used what should be the equivalent `dtruss` command. The repeating output of `dtruss -p <tmux server pid>` when tmux is frozen and taking 100% proc:
`
select(0x100, 0x7FCFC2703A10, 0x7FCFC2703A30, 0x0, 0x7FFF53F9D770) = -1 Err#9
write_nocancel(0x2, "[warn] select: Bad file descriptor\n\0", 0x23) = 35 0
select(0x100, 0x7FCFC2703A10, 0x7FCFC2703A30, 0x0, 0x7FFF53F9D770) = -1 Err#9
write_nocancel(0x2, "[warn] select: Bad file descriptor\n\0", 0x23) = 35 0
select(0x100, 0x7FCFC2703A10, 0x7FCFC2703A30, 0x0, 0x7FFF53F9D770) = -1 Err#9
write_nocancel(0x2, "[warn] select: Bad file descriptor\n\0", 0x23) = 35 0
select(0x100, 0x7FCFC2703A10, 0x7FCFC2703A30, 0x0, 0x7FFF53F9D770) = -1 Err#9
write_nocancel(0x2, "[warn] select: Bad file descriptor\n\0", 0x23) = 35 0
select(0x100, 0x7FCFC2703A10, 0x7FCFC2703A30, 0x0, 0x7FFF53F9D770) = -1 Err#9
write_nocancel(0x2, "[warn] select: Bad file descriptor\n\0", 0x23) = 35 0
`


---

Sent from sourceforge.net because tmux-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/tmux/tickets/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/tmux/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Loading...