Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman attach does not exit when the container stops #8154

Closed
faulesocke opened this issue Oct 26, 2020 · 7 comments · Fixed by #8175
Closed

podman attach does not exit when the container stops #8154

faulesocke opened this issue Oct 26, 2020 · 7 comments · Fixed by #8175
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@faulesocke
Copy link

/kind bug

Description
When attaching to a self-quitting container (for example one with "CMD sleep 10") with podman attach <id>, the podman attach process does not exit once the container stops. This was different in the past and is unexpected. I use attach to see logs and wait for the container to finish.

Steps to reproduce the issue:

podman build -t test -f - << EOF
FROM whatever
CMD sleep 100
EOF
podman run -d --name foo test
  1. attach to the container and wait for it to exit:
podman attach foo

Describe the results you received:
podman attach never returns

Describe the results you expected:
podman attach returns after approx. 10 seconds

Output of podman version:

% podman version                                                                                                                     :(
Version:      2.1.1
API Version:  2.0.0
Go Version:   go1.15.2
Built:        Thu Jan  1 01:00:00 1970
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.16.1
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: Unknown
    path: /usr/libexec/podman/conmon
    version: 'conmon version 2.0.21, commit: unknown'
  cpus: 4
  distribution:
    distribution: '"void"'
    version: unknown
  eventLogger: file
  hostname: Sockpad
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 4.19.142+
  linkmode: dynamic
  memFree: 1153695744
  memTotal: 16384040960
  ociRuntime:
    name: runc
    package: Unknown
    path: /usr/bin/runc
    version: 'runc version spec: 1.0.2-dev'
  os: linux
  remoteSocket:
    path: /tmp/run-1000/podman/podman.sock
  rootless: true
  slirp4netns:
    executable: /bin/slirp4netns
    package: Unknown
    version: |-
      slirp4netns version 1.1.4
      commit: b66ffa8e262507e37fca689822d23430f3357fe8
      libslirp: 4.3.1
      SLIRP_CONFIG_VERSION_MAX: 3
  swapFree: 0
  swapTotal: 0
  uptime: 152h 31m 11.62s (Approximately 6.33 days)
registries: {}
store:
  configFile: /home/socke/.config/containers/storage.conf
  containerStore:
    number: 5
    paused: 0
    running: 2
    stopped: 3
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /bin/fuse-overlayfs
      Package: Unknown
      Version: |-
        fusermount3 version: 3.10.0
        fuse-overlayfs: version 1.1.0
        FUSE library version 3.10.0
        using FUSE kernel interface version 7.31
  graphRoot: /home/socke/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 26
  runRoot: /tmp/run-1000/containers
  volumePath: /home/socke/.local/share/containers/storage/volumes
version:
  APIVersion: 2.0.0
  Built: 0
  BuiltTime: Thu Jan  1 01:00:00 1970
  GitCommit: ""
  GoVersion: go1.15.2
  OsArch: linux/amd64
  Version: 2.1.1

Package info (e.g. output of rpm -q podman or apt list podman):

% xq podman
pkgver: podman-2.1.1_1
short_desc: Simple management tool for containers and images
architecture: x86_64
filename-sha256: 4644867b3b093c0f2fbc3c95b70dffb44176bb6b14dfba44e43f10128e4b1d65
filename-size: 20MB
homepage: https://podman.io/
installed_size: 48MB
license: Apache-2.0
maintainer: Cameron Nemo <[email protected]>
pkgname: podman
repository: https://alpha.de.repo.voidlinux.org/current
run_depends:
	runc>=0
	conmon>=0
	cni-plugins>=0
	slirp4netns>=0
	containers.image>=0
	glibc>=2.29_1
	libgpgme>=1.12.0_2
	libassuan>=2.0.1_1
	libgpg-error>=1.6_1
	libseccomp>=2.0.0_1
	device-mapper>=2.02.110_1
shlib-requires:
	libpthread.so.0
	libgpgme.so.11
	libassuan.so.0
	libgpg-error.so.0
	libseccomp.so.2
	librt.so.1
	libdevmapper.so.1.02
	libc.so.6
source-revisions: podman:b990889240
depends:
	runc>=0
	conmon>=0
	cni-plugins>=0
	slirp4netns>=0
	containers.image>=0
	glibc>=2.29_1
	libgpgme>=1.12.0_2
	libassuan>=2.0.1_1
	libgpg-error>=1.6_1
	libseccomp>=2.0.0_1
	device-mapper>=2.02.110_1

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

No

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 26, 2020
@Luap99
Copy link
Member

Luap99 commented Oct 27, 2020

I'm not sure why it doesn't work but it seems to work if you add the -t option to the run command, e.g. podman run -d -t --name foo test.

@rhatdan
Copy link
Member

rhatdan commented Oct 28, 2020

@mheon Thoughts on this one?

@mheon
Copy link
Member

mheon commented Oct 28, 2020

I'll take a look, see if I can reproduce

@mheon
Copy link
Member

mheon commented Oct 28, 2020

Works fine over here. Your Dockerfile looks suspicious - you say you expect the container to exit after 10 seconds, but you have a sleep 100 in there, so I'd expect it would take 100 seconds instead...

@mheon
Copy link
Member

mheon commented Oct 28, 2020

Ahhh, nevermind, I see that it does reproduce when -t is not used. Interesting.

@mheon
Copy link
Member

mheon commented Oct 28, 2020

This is very interesting. The attach socket is completely removed, Conmon is dead, but Podman is still listening on it.

mheon added a commit to mheon/libpod that referenced this issue Oct 28, 2020
We only use this channel in terminal attach, and it was not a
buffered channel originally, so it would block on trying to send
unless a receiver was ready. In the non-terminal case, there was
no receiver, so attach blocked forever. Buffer the channel for a
single bool so that it will never block, even if unused.

Fixes containers#8154

Signed-off-by: Matthew Heon <[email protected]>
@mheon
Copy link
Member

mheon commented Oct 28, 2020

Got it - #8175

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants