Closed Hendrik-H closed 3 years ago
Thanks for opening the issue, @Hendrik-H!
Can you run podman inspect --format "{{.HostConfig.LogConfig}}"
on a local container? I want to check which log driver is currently used on your machine.
{k8s-file map[] /home/haddorp/.local/share/containers/storage/overlay-containers/bbef0632a6ce0a05c58bea3367907d8a13bf05c6a8e6701b712a20cd0b06f00e/userdata/ctr.log 0B}
I opened https://github.com/containers/podman/pull/10600 to fix the issue.
@Hendrik-H, note that there's an inherent race when using --rm
and logs -f
.
AFAIKS, the log file may get removed before we could fully read it. @mheon do you think it's sad fact of life or shall we tackle it one way or another?
@vrothberg thanks for the tip and the quick fix
@vrothberg It might get removed, but we'll still have an open file descriptor, no?
I don't think we can do this another way, this is in the c/storage directories and if we don't remove it removing the storage container will fail.
@vrothberg It might get removed, but we'll still have an open file descriptor, no?
Probably. I had to dig deeper on how things like inotify might be used. One odd thing is that journald also flakes/d with --rm
.
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
A container traps SIGINT and SIGTERM, logs a few things, waits a few seconds, logs more and then exits. A parallel
podman logs -f ...
for that container does not capture all the logs and ends early when the container is stopped usingpodman stop
. I believe I also had a case that a bit was missing when stopping withctrl-c
but I can not reproduce that anymore.Test Dockerfile:
Test Script:
Steps to reproduce the issue:
podman build -t=podman-test .
podman run -it --name test --rm podman-test
podman logs -f test
podman stop --time 10 test
Describe the results you received: When using
podman stop
the logs stop straight away in thepodman logs -f
terminal and some logs that are still coming out in thepodman run
terminal are missing. When you try to restartpodman logs -f
while the container is in thestopping
state you can not follow the logs anymore.Describe the results you expected:
podman logs -f
to log out all logs until the container is fully stopped and not just until it is starting to stop.Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
No
Additional environment details (AWS, VirtualBox, physical, etc.): laptop