tmux sometimes freezing for around 15 seconds, then becoming responsive again

44 views
Skip to first unread message

Kevin Kaland

unread,
May 5, 2020, 12:30:23 PM5/5/20
to tmux-users
System:

LSB Version: n/a
Distributor ID: ManjaroLinux
Description: Manjaro Linux
Release: 20.0
Codename: Lysia

tmux 3.1a

Within the past couple of weeks or past month, I've started getting freezes in tmux, often just after attaching to a session, and then periodically within the session. I use the tmux-resurrect and tmux-continuum plugins. I am wondering if the history they are saving could be making tmux hang while processing something. However, I'm not really sure how to debug this. Are there any debug logs or timing logs I could try to record and then submit somewhere or review myself? When the issue occurs, I can see tmux working in `htop`. Sometimes my computer's fan even comes on in tandem with the freeze. But I am not sure what it's processing. A lot of my history seems to have disappeared recently, anyway, so I'm not sure that I'm on the right track there.

I wanted to post here before posting a GitHub issue so that I could post a better one if I wound up doing so.

Nicholas Marriott

unread,
May 5, 2020, 12:34:00 PM5/5/20
to Kevin Kaland, tmux-users
Hi

Is this when you resize the terminal?

Does it still happen if you turn off tmux-resurrect and tmux-continuum?

If you can reproduce you can run tmux with logging:

https://github.com/tmux/tmux/blob/master/.github/CONTRIBUTING.md#how-do-i-get-logs-from-tmux
> --
> You received this message because you are subscribed to the Google Groups
> "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tmux-users+...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/tmux-users/d9f017fe-ae02-4fed-9725-5cc243da1243%40googlegroups.com.

Kevin Kaland

unread,
May 11, 2020, 11:00:35 AM5/11/20
to tmux-users
Hi,

Oh, wow! It does happen when resizing the terminal. I had not even noticed. That explains why it often happens after attaching after a computer restart, I guess.

I see in https://github.com/tmux/tmux/issues/2197 that this was a libevent issue. But I'm on Manjaro, a rolling release, and my system libevent is 2.1.11-5. So I'm not sure if it's the same issue.

Maybe step 1 is to disable the plugins and see if the issue persists.
>    email to tmux-...@googlegroups.com.

Kevin Kaland

unread,
May 11, 2020, 11:10:47 AM5/11/20
to tmux-users
Turned plugins off and on...and now it's not happening when resizing anymore. I'll keep an eye on things. I did run
<prefix>I

to update my plugins. Maybe I had an old version or something. I forget if tpm keeps them up-to-date automatically or not.

I'll see if it happens again.

Kevin Kaland

unread,
May 11, 2020, 2:42:41 PM5/11/20
to tmux-users
Ran into this again. This time, once things unfroze, I couldn't reproduce it by splitting the window and then trying to resize it. I am not sure if it requires the splits to already exist in order for resizing to trigger it.

If I can figure out a consistent set of steps to reproduce, I'll log it and open an issue.

Kevin Kaland

unread,
May 18, 2020, 1:43:03 PM5/18/20
to tmux-users
Ran into this when exiting a split today, which caused other ones with a lot of text (I did a backup of an old external drive and printed each file that was getting added to the backup repository, about 10 million lines) to resize and that seemed to take a bit. Not that surprising. But then I did it again, and it didn't take as long, so I'm a bit confused as to what actually triggers it.

It definitely does happen more often when I have panes (whether attached to or not, seemingly) that have a lot of history in them. My history limit is currently 999999999, but maybe I should try knocking it down some.

Do you know around which point tmux starts to slow down noticeably (or how I might estimate that)? I have a fairly late-model laptop with good specs.

Nicholas Marriott

unread,
May 19, 2020, 1:29:24 AM5/19/20
to Kevin Kaland, tmux-users
If you have 10 million lines in a pane's history then resizing will take
a while because tmux will need to walk every line in order to see if it
needs to reflow it. This is likely to be about 1-2 GB of history so it
will take a while. It will be quicker if you do it twice in succession
because it will need to do less work and the history is likely to be
already in memory or cache.

Why do you need such a big history? Surely there is no realistic way you
can work with it interactively? Why not just write the output to a file
with tee? If you had 10 panes with 10 million lines, tmux will be using
up to 20 GB of memory.

There was some work on storing history in chunks so it could reflow
sections on demand but it is complicated and was never finished. You
will need to experiment to see what size of history is fast enough for
you but I would probably start with 100000 lines.

If you must have a huge history limit, you can try turning off reflow by
making this change and rebuilding tmux:

diff --git a/screen.c b/screen.c
index 95299306..4e0e03e6 100644
--- a/screen.c
+++ b/screen.c
@@ -226,6 +226,8 @@ screen_resize_cursor(struct screen *s, u_int sx, u_int sy, int reflow,
{
u_int cx = s->cx, cy = s->grid->hsize + s->cy;

+ reflow = 0;
+
if (s->write_list != NULL)
screen_write_free_list(s);
> Oh, wow! It doesA happen when resizing the terminal. I had not even
> noticed. That explains why it often happens after attaching after a
> computer restart, I guess.
> I see inA https://github.com/tmux/tmux/issues/2197A that this was a
> libevent issue. But I'm on Manjaro, a rolling release, and my system
> libevent is 2.1.11-5. So I'm not sure if it's the same issue.
> Maybe step 1 is to disable the plugins and see if the issue
> persists.
> On Tuesday, May 5, 2020 at 6:34:00 PM UTC+2, Nicholas Marriott
> wrote:
>
> Hi
>
> Is this when you resize the terminal?
>
> Does it still happen if you turn off tmux-resurrect and
> tmux-continuum?
>
> If you can reproduce you can run tmux with logging:
>
> https://github.com/tmux/tmux/blob/master/.github/CONTRIBUTING.md#how-do-i-get-logs-from-tmux
>
> On Tue, May 05, 2020 at 09:30:22AM -0700, Kevin Kaland wrote:
> > A A System:
> > A A LSB Version: n/a
> > A A Distributor ID: A ManjaroLinux
> > A A Description: A Manjaro A Linux
> > A A Release: A 20.0
> > A A Codename: A Lysia
> > A A tmux 3.1a
> > A A Within the past couple of weeks or past month, I've started
> getting
> > A A freezes in tmux, often just after attaching to a session,
> and then
> > A A periodically within the session. I use the tmux-resurrect
> and
> > A A tmux-continuum plugins. I am wondering if the history they
> are saving
> > A A could be making tmux hang while processing something.
> However, I'm not
> > A A really sure how to debug this. Are there any debug logs or
> timing logs I
> > A A could try to record and then submit somewhere or review
> myself? When the
> > A A issue occurs, I can see tmux working in `htop`. Sometimes
> my computer's
> > A A fan even comes on in tandem with the freeze. But I am not
> sure what it's
> > A A processing. A lot of my history seems to have disappeared
> recently,
> > A A anyway, so I'm not sure that I'm on the right track there.
> > A A I wanted to post here before posting a GitHub issue so that
> I could post a
> > A A better one if I wound up doing so.
> >
> > A A --
> > A A You received this message because you are subscribed to the
> Google Groups
> > A A "tmux-users" group.
> > A A To unsubscribe from this group and stop receiving emails
> from it, send an
> > A A email to tmux-...@googlegroups.com.
> > A A To view this discussion on the web, visit
> > A
> A https://groups.google.com/d/msgid/tmux-users/d9f017fe-ae02-4fed-9725-5cc243da1243%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups
> "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tmux-users+...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/tmux-users/cc777e34-09cb-4a83-820c-a78de8a37267%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages