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

flake: podman logs: sometimes emits wrong output #8879

Closed
edsantiago opened this issue Jan 4, 2021 · 6 comments · Fixed by #8904
Closed

flake: podman logs: sometimes emits wrong output #8879

edsantiago opened this issue Jan 4, 2021 · 6 comments · Fixed by #8904
Labels
flakes Flakes from Continuous Integration 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

@edsantiago
Copy link
Member

podman logs is sometimes returning the wrong result. It actually seems to be a problem with the stored output, not podman logs itself; i.e. once a container gets in this bad state, all future podman logs commands will fail.

Simpleminded overview (not a reproducer):

$ ./bin/podman run -t --name test IMG sh -c 'echo 1;echo 2'
1
2
$ ./bin/podman logs test
<something other than '1 2'>

Sample failed results:

  • '1', 2nd line is empty
  • empty line, '2' on second line
  • empty line, '12' on second line

Context: seeing this kind of regularly in integration tests:

Podman logs [It] Make sure logs match expected length

Reproducer [podman-logs-flake.sh.txt]:

#!/bin/sh

img=quay.io/libpod/testimage:20200929
expect=

while :;do
    ./bin/podman run -t --name test $img sh -c 'echo 1;echo 2'
# The integration test has a 'wait'; this is not actually necessary, test will fail even without it
#    ./bin/podman wait test
    x=$(./bin/podman logs test)
    printf "%q\n" $x

    # First time through
    if [[ -z "$expect" ]]; then
        expect=$x
    fi

    if [[ "$x" != "$expect" ]]; then
        echo -ne '\a'
        echo "*********************"
        echo
        exit
    fi
    ./bin/podman rm test
done

It takes several hours to fail on my laptop. Once it fails, the container is left in place, and all subsequent podman log test commands will remain consistent with the first failure.

master @ 23f25b8. Seems to happen both root and rootless, f32 and f33; even once on ubuntu 19.

@edsantiago edsantiago added flakes Flakes from Continuous Integration kind/bug Categorizes issue or PR as related to a bug. labels Jan 4, 2021
@edsantiago
Copy link
Member Author

Update: it's looking likely that the -t is the culprit. I've had the reproducer running for the last 3+ hours, without -t, and no failure yet. I'll let it run overnight.

@edsantiago
Copy link
Member Author

Forgot to update here: the job without -t ran all night, over twelve hours. I stopped it, added back -t, job failed within two hours.

@Luap99
Copy link
Member

Luap99 commented Jan 6, 2021

Can you paste the content of the log file please? It could be that podman logs works correct and the file is wrong.

@edsantiago
Copy link
Member Author

Good idea.

$ ./bin/podman logs test | cat -vET
1^M$
^M$
$ cat -vET ~/.local/share/containers/storage/overlay-containers/<sha>/userdata/ctr.log
2021-01-05T09:30:48.745347870-07:00 stdout F 1^M$
2021-01-05T09:30:48.745347870-07:00 stdout P 2$
2021-01-05T09:30:48.745582542-07:00 stdout F ^M$

On a good container:

$ cat -vET ~/.local/share/containers/storage/overlay-containers/<sha>/userdata/ctr.log
2021-01-06T13:53:05.349022525-07:00 stdout F 1^M$
2021-01-06T13:53:05.349022525-07:00 stdout F 2^M$

@Luap99
Copy link
Member

Luap99 commented Jan 6, 2021

OK podman logs is wrong. I will open a PR.

Luap99 pushed a commit to Luap99/libpod that referenced this issue Jan 6, 2021
If a partial log line has the length 1 it was ignored by podman logs.

Fixes containers#8879

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
@Luap99
Copy link
Member

Luap99 commented Jan 6, 2021

#8904

@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
flakes Flakes from Continuous Integration 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.

2 participants