Public bug reported:

Summary. On Ubuntu 24.04 (noble), a tmux 3.4 server can die with SIGSEGV
when a grouped session's client is detached with detach-client and
destroy-unattached keep-group then destroys that session. It happens
under CPU load, often on the first few detaches. Every session on the
server ends with it. 3.4-1ubuntu0.3 in noble-proposed, which fixes the
zoomed-window crashes of LP: #2172863, doesn't fix this one. No zoom is
involved.

Steps to reproduce (attached repro.sh; it needs only tmux and
script(1)):

    Start a private server (-L, its own TMUX_TMPDIR) whose config is the
single line set -g destroy-unattached keep-group.

    Make an anchor session with destroy-unattached off, which keeps the
server up, and a session foo with destroy-unattached off and three
panes.

    Repeat up to 21 times:
        attach a new grouped session to it through a real pty: script -qfc 
"tmux -L S new-session -t =foo -s foo~N" /dev/null;
        wait for its client to register;
        run tmux -L S detach-client -s =foo~N.

    keep-group then destroys foo~N.

    Keep every CPU busy while it runs (one while :; do :; done per CPU).

    After each cycle, check that the server pid is alive and list-
sessions works.

Run: bash repro.sh detach prints detach alive or detach DEAD at cycle N.
Other cases in the script: hangup (SIGHUP to the client instead of
detach-client), keep-detach (empty config, so the detached session isn't
destroyed), and detachkey (the client types C-b d).

Results. Clean ubuntu:noble container, Ubuntu 24.04.5 LTS, amd64, 8 CPUs, all 
loaded, 15 runs per cell:
Case    3.4-1ubuntu0.2 (noble-updates)  3.4-1ubuntu0.3 (noble-proposed)
detach (detach-client, keep-group destroys the session)         server died 
7/15        server died 10/15
hangup (SIGHUP to the client, keep-group destroys the session)  survived 15/15  
survived 15/15
keep-detach (detach-client, empty config, session not destroyed)        
survived 15/15  survived 15/15
detachkey (C-b d typed through script(1))       survived 15/15  survived 15/15

On a second amd64 machine (28 CPUs, loaded), 3.4-1ubuntu0.2 gave:

    detach: died 4/6 with this script;
    without load: 0/15 in a similar harness.

In a different harness, where the client is driven on its own pty and
types C-b d itself, the server died 12/15 on the same machine. So a
user's own detach key may reach it, though repro.sh's detachkey case
hasn't shown that.

Core. With cores enabled, 7 crashes on 3.4-1ubuntu0.2 left 7 cores, all
SIGSEGV at the same offset in the stripped /usr/bin/tmux (+0x8fc05). The
stack wasn't symbolised: no debug symbols or gdb on that machine. For
comparison, the #2172863 route (zoom, then kill) aborts in libc instead,
so we can't say whether the two share a cause. We can provide a
symbolised trace if that helps.

Not tested: tmux 3.5a or upstream master.

Workaround: don't let destroy-unattached destroy grouped sessions. Set
it off on them and remove them with kill-session after the client has
gone. In the runs above, an explicit kill-session of an unzoomed grouped
session never crashed: 0/60 under load.

** Affects: tmux (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "script that reproduces the issue"
   https://bugs.launchpad.net/bugs/2174681/+attachment/6018713/+files/repro.sh

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2174681

Title:
  tmux 3.4 server segfaults when destroy-unattached keep-group destroys
  a grouped session after detach-client (not fixed by 3.4-1ubuntu0.3)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/tmux/+bug/2174681/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to