Skip to content

nerdctl attach freezes the terminal sessions randomly. #4374

Open

Description

@Mr-Sunglasses

Description

When attaching two terminal sessions using nerdctl attach and executing commands, the terminal randomly freezes and doesn't display the commands being entered.

output.mp4

Steps to reproduce the issue

  1. sudo nerdctl run -it --rm --name enipla alpine
  2. sudo nerdctl attach enipla

Describe the results you received and expected

This is the result when running with docker.

output-expected.mp4

What version of nerdctl are you using?

Client:
 Version:	v2.1.2
 OS/Arch:	linux/amd64
 Git commit:	2a2834dd1c926528aa141726a9a9132eb1665568
 buildctl:
  Version:	v0.23.0-rc1-24-g91ff73e1c
  GitCommit:	91ff73e1c26e761a64de9a05bc1e67387a7ef8d0

Server:
 containerd:
  Version:	1.7.27
  GitCommit:	05044ec0a9a75232cad458027ca83437aae3f4da
 runc:
  Version:	1.3.0
  GitCommit:	v1.3.0-0-g4ca628d1

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

Others

Host information

Client:
 Namespace:	default
 Debug Mode:	false

Server:
 Server Version: 1.7.27
 Storage Driver: overlayfs
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Log:     fluentd journald json-file none syslog
  Storage: native overlayfs
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version:   6.8.0-62-generic
 Operating System: Linux Mint 22.1
 OSType:           linux
 Architecture:     x86_64
 CPUs:             8
 Total Memory:     13.57GiB
 Name:             anton
 ID:               5616474f-8d43-470c-890a-3a1c59b1e89c

Activity

  1. apostasie commented on Jun 25, 2025

    @apostasie
    Contributor

    Yeah, this is unfortunate:

    https://github.com/containerd/nerdctl/blob/v2.1.2/cmd/nerdctl/container/container_attach.go#L44-L48

    Limitation of the original implementation: #2108

    Duplicate of #3570 I believe.

  2. apostasie commented on Jun 25, 2025

    @apostasie
    Contributor

    Help is welcome in fixing this...
    Note this is likely quite involved and requires a good grasp of IO.

  3. ChengyuZhu6 commented on Jul 2, 2025

    @ChengyuZhu6
    Member

    @apostasie I‘d like to take it on.

  4. ekalinin commented on Aug 31, 2026

    @ekalinin
    Contributor

    Same root cause as #3570, as @apostasie suspected: a FIFO has one queue, so two sessions reading the container's stdout each get a random subset of it. Nothing is dropped, it is just handed to whichever reader asked first, which is why one terminal looks frozen while the other prints characters it never asked for.

    I have posted a design proposal for fixing this properly in #3570, since that is the tracking issue for it. Happy to take the discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions