4

I have a log file that I am writing a few hundred lines to a second. I want to tail this in a tmux pane.

However, when I do this tmux becomes unresponsive - I can't change panes or windows and I can't even CTRL+C to stop tail.

After about 3 or so minutes tail will eventually be killed by CTRL+C and I will regain control - but until then I can't do anything (except change from terminal to another window such as my browser).

Is there anyway to resolve this? I suspect that the issue is being caused because so many lines are being written to the log file.

  • 2
    Have you tried tail without tmux? Have you tried it on another machine? – ohaal Jul 10 '13 at 10:27
  • Your question sounds more of a bug report to me. And bugs are off-topic here. askubuntu.com/help/on-topic – gertvdijk Jul 10 '13 at 10:51
3

The problem is more likely to be tmux overhead, especially if you've got a vertical split on your pane. You can set tmux to not update the screen when there are a bunch of control characters being written. See man tmux for more details, but I have the following in my ~/.tmux.conf.

set -g c0-change-trigger 20 #default is 250
set -g c0-change-interval 1000 #default is 100

This tells tmux that when 20 control sequences per milliseconds are being printed to the screen, tmux should change it's update interval to once per 1000 milliseconds (1/sec).

  • looks good, but I had to use c0-change-trigger instead of c0-trigger – Yoav Aner Feb 4 '15 at 14:05
  • thanks @YoavAner. I edited my answer. It c0-change-trigger was what I meant. – William Everett Feb 4 '15 at 21:16
  • 1
    For reference this made no improvements – Andy Smith Mar 31 '16 at 19:16
  • 1
    Note that starting with tmux version 2.1, The c0-* options for rate-limiting have been removed. Instead, a backoff approach is used (see the changelog). As of right now the version that you get from the main ubuntu repositories is 2.3, so if you recently installed it you won't have support for those options. – Severyn Kozak Aug 29 '17 at 16:50
2

This has been greatly improved in tmux 2.1.

The c0- options metioned in other answers have been removed and a back off approach to buffering introduced: https://raw.githubusercontent.com/tmux/tmux/master/CHANGES

1

This is NOT likely to be caused by tailing log file which is being written a few hundred times per second.

Try to ssh to the box or open another terminal session, use strace to attach to the tmux process, see the system calls made by and signals received by the process. This will definitely help.

Example: strace -tT -pPID

Output to a file strace -tT -pPID -o /path/to/tmux_output

NOTE: strace is a light-weight debugger, it helped me to solve several tmux related problem in the past, e.g. tmux not able to create / remove files/directories in /var/run or /run.

0

I know that this will not solve your problem, but try to pipe the output of the command to either less or more:

  • less allows you to scroll from within even a non-scrollable terminal:

    <command> | less
    
  • more prints a page then you press enter to bring up every line after that:

    <command> | more
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.