Bundled Dropbear 2024.85 aborts SSH connections on concurrent channel open/close

Open Beginner friendly
#17,416 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
docker, linux, shell

Research direction

Start with scripts/agent/build-dropbear.sh and update the pinned Dropbear version from DROPBEAR_2024.85 to DROPBEAR_2024.86. Rebuild the bundled dropbearmulti.*.bin artifacts using the script's existing configure options and patches. Verify with the described interactive PTY plus parallel exec-channel test and confirm that the connection remains open.

Written by the indexing model from the issue text.

Description

What Operating System(s) are you seeing this problem on?

Linux (x86-64)

Backend.AI version

26.8.1 (lablup/backend.ai-agent:26.8.1)

Describe the bug

The container sshd bundled with the agent is built from DROPBEAR_2024.85 (scripts/agent/build-dropbear.sh). That version aborts the whole SSH connection when one channel is closed while another is being opened on the same connection:

Password auth succeeded for 'work' from ...
Exit (work) from <...>: Failed assertion (src/common-channel.c:705): `!channel->sent_close'

This is upstream Dropbear bug mkj/dropbear#321, a regression since 2022.82, fixed in Dropbear 2024.86 ("Fix failure on concurrent channel open/close").

Common clients open channels concurrently, so users get disconnected a few seconds after logging in: terminals with shell integration (e.g. Warp, which opens extra channels to bootstrap its prompt), VS Code Remote-SSH, and OpenSSH connection sharing (ControlMaster). Plain single-channel ssh sessions are not affected.

To Reproduce
  1. Start a session and its sshd service (we use a TCP App Proxy port).
  2. Open a shared OpenSSH master connection and run several commands in parallel over it:
    ssh -M -S /tmp/mux -p <port> work@<host>          # interactive shell, keep it open
    for i in $(seq 8); do ssh -S /tmp/mux -p <port> work@<host> true & done; wait
    
  3. The master connection is closed with Connection to <host> closed by remote host., and the kernel container log shows the failed assertion above.

The same happens with any SSH library opening and closing exec channels in parallel next to an interactive PTY session.

Expected Behavior

Concurrent channels on one connection work and the interactive session stays open.

Anything else?

Rebuilding dropbearmulti with --branch "DROPBEAR_2024.86" and otherwise the same configure options and sed patches as scripts/agent/build-dropbear.sh fixes it: in our test (an interactive PTY session plus 5 rounds of 8 parallel exec channels on the same connection) the connection drops every time with 2024.85 and stays up with 2024.86. Upgrading the pinned version in build-dropbear.sh and the bundled dropbearmulti.*.bin should be enough.

Dominant language
Python
Stars
683
Forks
187
Avg merge
23h 18m
Merged PRs (30d)
760

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lablup/backend.ai

All issues in lablup/backend.ai

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.