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 prints nothing until modification #6253

Closed
x70b1 opened this issue May 17, 2020 · 12 comments · Fixed by #7592
Closed

podman attach prints nothing until modification #6253

x70b1 opened this issue May 17, 2020 · 12 comments · Fixed by #7592
Assignees
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

@x70b1
Copy link

x70b1 commented May 17, 2020

Description

If I attach to a container the terminal is still empty until:

  • I press a key to change the output on the screen (like enter in a shell)
  • I resize the screen

I could not find any other issue with that problem.

/kind bug

Steps to reproduce the issue:

  1. podman run --name test -it debian bash
  2. podman attach test

Describe the results you expected:

I would expect that there is an output without modify the screen size or the content.
docker handles this case better.

Output of podman version:

Version:            1.9.1
RemoteAPI Version:  1
Go Version:         go1.11.6
OS/Arch:            linux/amd64
@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label May 17, 2020
@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jul 10, 2020

@mheon PTAL

@x70b1
Copy link
Author

x70b1 commented Sep 3, 2020

I got a message ERRO[0000] normal attach now.
But there is still no content until screen resizing.

@mheon
Copy link
Member

mheon commented Sep 3, 2020

I think we must have changed something about how resize is handled that broke this. We used to unconditionally resize the screen, which would trigger terminal prompts to re-display. It looks like this was disabled at some point, though...

@mheon
Copy link
Member

mheon commented Sep 10, 2020

Alright, this is not as simple as I assumed. We are actually sending a resize event, but it's not forcing a redraw of the terminal.

Further, I'm seeing that detaching from an attach session is actively killing the container, which is definitely not good.

@mheon
Copy link
Member

mheon commented Sep 10, 2020

Also, very confusing: I have no idea where the "normal attach" error message is coming from. That string exists nowhere in Podman or Conmon, nor do I see any obvious string composition of error messages.

@mheon
Copy link
Member

mheon commented Sep 10, 2020

Ah, found it - looks like leftover debug from a c/image update from @vrothberg that slipped into the v2.0 branch and nowhere else.

@x70b1
Copy link
Author

x70b1 commented Sep 10, 2020

I tested it again. Something else that I found: podman leaves the container with unclean output.

podman run -it debian bash
apt update, apt install htop
htop
press ctrl+p, then ctrl+q

I got my old prompt from the host system. But the output of htop is still hanging around until I override it with some other content.

@mheon
Copy link
Member

mheon commented Sep 10, 2020

Ah, think I have it. We need to send a SIGWINCH to the container to force redraw after attach completes.

@mheon
Copy link
Member

mheon commented Sep 10, 2020

#7592 to fix

mheon added a commit to mheon/libpod that referenced this issue Sep 10, 2020
Basically, we want to force the application in the container to
(iff the container was made with a terminal) redraw said terminal
immediately after an attach completes, so the fresh Attach
session will be able to see what's going on (e.g. will have a
shell prompt). Our current attach functions are unfortunately
geared more towards `podman run` than `podman attach` and will
start forwarding resize events *immediately* instead of waiting
until the attach session is alive (much safer for short-lived
`podman run` sessions, but broken for the `podman attach` case).
To avoid a major rewrite, let's just manually send a SIGWINCH
after attach succeeds to force a redraw.

Fixes containers#6253

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

I came across this bug as well. Is it possible to also print a newline when detaching? Docker prints read escape sequence to stderr which adds a newline, avoiding this: root@d6d95918c007:/# [user@host ~]$ .

@mheon
Copy link
Member

mheon commented Sep 23, 2020

Can you open a fresh bug about that? But sure, that should be doable.

@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.

6 participants