Skip to content

tmux server terminates when client via SSH closes its Terminal #3245

@moritzdietz

Description

@moritzdietz

Issue description

I'd like to ask for some help troubleshooting this issue, as I can't find out what's causing this on my own.

I have the following workflow:

flowchart LR
    hosta(Host A)
    hostb(Host B)
    tmuxserver(tmux server)
    tmuxsession(tmux session)
    subgraph Host A local
        direction LR
        hosta --> Alacritty
        Alacritty --> SSH
    end
    subgraph Host B local
        direction LR
        SSH .-> hostb
        hostb --> tmuxserver
        tmuxserver --> tmuxsession
    end
Loading

This usually works pretty reliably. When Host A reboots or powers off, I can just resume my tmux session later on Host B.
Now, for a couple of days now but I can't pinpoint it to when exactly, I noticed that the tmux server would die on Host B whenever I close the Alacritty window and thus the SSH connection on Host A when I'm still inside of any tmux session on Host B.
This is always reproducible.

To troubleshoot I tried this:

flowchart LR
    subgraph Host B local
    direction LR
        hostb(Host B)
        tmuxserver(tmux server)
        tmuxsession(tmux session)
        hostb --> tmuxserver
        tmuxserver --> tmuxsession
    end
Loading

Open Alacritty locally on Host B with no tmux server running. I start tmux and thus a new server and session, then close Alacritty. Re-open Alacritty and run tmux ls - my session is still there. I can just re-attach to it as expected.

This seems to only occur whenever Host A connects to Host B via SSH and I close the Alacritty window on Host A or any other terminal like GNOME Terminal.
This issue does not occur when I detach from tmux via the tmux detach command. Then the server lives on.
It also occurs when you detach from the tmux session, close the SSH connection from Host A to Host B and re-connect via SSH; the tmux server died.

In the debug logs of the server I see this:

1656510343.992709 server_signal: Hangup
1656510343.992719 server_signal: Terminated
1656510343.992723 session 0 destroyed (server_send_exit)

Required information

Please provide the following information:

  • tmux version (tmux -V).
    tmux build on: 2022-06-29 11:22:46+02:00 Commit: d8c527a5
  • Platform (uname -sp).
    Linux x86_64
  • $TERM inside and outside of tmux (echo $TERM).
    alacritty (outside), tmux-256color (inside)
  • Logs from tmux (tmux kill-server; tmux -vv new).
    I have the debug logs and can submit them on request as this has sensitive environment variables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions