containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.44k stars 2.38k forks source link

e2e: ExitWithError() will determine an incorrect exit code and result in an error. #24213

Open hiramotom opened 4 days ago

hiramotom commented 4 days ago

Issue Description

It seems that the changes made by #22661 might not be completely accurate. When I ran the command in test environment, it returned an error: "Command exited with status 134 (expected 2)". Could this test result be different depending on the environment?

I believe this code is causing the error output.

Steps to reproduce the issue

  1. Run run_signal_test.go

    # FOCUS_FILE="run_signal_test.go" QUADLET_BINARY=/usr/libexec/podman/quadlet PATH=${PATH}:$(pwd)/hack PODMAN_BINARY=$(which podman) PODMAN_REMOTE_BINARY=$(which podman-remote) CGROUP_MANAGER=$(podman info --format {{.Host.CgroupManager}}) NETWORK_BACKEND=$(podman info --format {{.Host.NetworkBackend}}) OCI_RUNTIME=$(podman info --format {{.Host.OCIRuntime.Name}}) STORAGE_FS=overlay ROOTLESS_STORAGE_FS=overlay make localintegration`

    2.The results will be output, so I will check them.

    
    ...snip...
    SIGQUIT: quit
    PC=0x561b8b47ba41 m=10 sigcode=0
    
    goroutine 0 gp=0xc0004d6380 m=10 mp=0xc0004a4808 [idle]:
    runtime.futex(0xc0004a4948, 0x80, 0x0, 0x0, 0x0, 0x0)
        /usr/lib/golang/src/runtime/sys_linux_amd64.s:557 +0x21 fp=0x7f7a99fffa78 sp=0x7f7a99fffa70 pc=0x561b8b47ba41
    runtime.futexsleep(0x7f7a99fffaf0?, 0x8b410750?, 0x561b8b410750?)
        /usr/lib/golang/src/runtime/os_linux.go:69 +0x30 fp=0x7f7a99fffac8 sp=0x7f7a99fffa78 pc=0x561b8b43adb0
    runtime.notesleep(0xc0004a4948)
        /usr/lib/golang/src/runtime/lock_futex.go:170 +0x87 fp=0x7f7a99fffb00 sp=0x7f7a99fffac8 pc=0x561b8b4108e7
    runtime.mPark(...)
        /usr/lib/golang/src/runtime/proc.go:1761
    runtime.stopm()
        /usr/lib/golang/src/runtime/proc.go:2782 +0x8c fp=0x7f7a99fffb30 sp=0x7f7a99fffb00 pc=0x561b8b445aec
    runtime.findRunnable()
        /usr/lib/golang/src/runtime/proc.go:3512 +0xd5f fp=0x7f7a99fffca8 sp=0x7f7a99fffb30 pc=0x561b8b44765f
    runtime.schedule()
        /usr/lib/golang/src/runtime/proc.go:3868 +0xb1 fp=0x7f7a99fffce0 sp=0x7f7a99fffca8 pc=0x561b8b448731
    runtime.goexit0(0xc0002d96c0?)
        /usr/lib/golang/src/runtime/proc.go:4181 +0x18 fp=0x7f7a99fffcf8 sp=0x7f7a99fffce0 pc=0x561b8b4495d8
    runtime.mcall()
        /usr/lib/golang/src/runtime/asm_amd64.s:458 +0x50 fp=0x7f7a99fffd10 sp=0x7f7a99fffcf8 pc=0x561b8b477bf0
    rax    0xca
    rbx    0x0
    rcx    0x561b8b47ba43
    rdx    0x0
    rdi    0xc0004a4948
    rsi    0x80
    rbp    0x7f7a99fffab8
    rsp    0x7f7a99fffa70
    r8     0x0
    r9     0x0
    r10    0x0
    r11    0x286
    r12    0x15
    r13    0x1
    r14    0xc0004d6380
    r15    0x1
    rip    0x561b8b47ba41
    rflags 0x286
    cs     0x33
    fs     0x0
    gs     0x0
    test2
    [FAILED] Command exited with status 134 (expected 2)
    In [It] at: /root/podman-upstream/test/e2e/run_signal_test.go:115 @ 10/07/24 04:51:30.368
    
    Full Stack Trace
    github.com/containers/podman/v5/test/e2e.init.func98.2()
        /root/podman-upstream/test/e2e/run_signal_test.go:115 +0x428
    < Exit [It] signals are not forwarded to container with sig-proxy false - /root/podman-upstream/test/e2e/run_signal_test.go:93 @ 10/07/24 04:51:30.368 (2.071s)
    > Enter [AfterEach] TOP-LEVEL - /root/podman-upstream/test/e2e/common_test.go:122 @ 10/07/24 04:51:30.368
    Running: /usr/bin/podman --storage-opt overlay.imagestore=/tmp/podman-e2e-2134768457/imagecachedir --root /tmp/podman-e2e-2134768457/subtest-2968878380/root --runroot /tmp/podman-e2e-2134768457/subtest-2968878380/runroot --runtime crun --conmon /usr/bin/conmon --network-config-dir /etc/containers/networks --network-backend netavark --cgroup-manager systemd --tmpdir /tmp/podman-e2e-2134768457/subtest-2968878380 --events-backend file --db-backend sqlite --storage-driver overlay stop --all -t 0
    3f7501ec1389c8da7224ec95ec58cc4ad10c8334bfd082c7f7f271975f5c0d16
    Running: /usr/bin/podman --storage-opt overlay.imagestore=/tmp/podman-e2e-2134768457/imagecachedir --root /tmp/podman-e2e-2134768457/subtest-2968878380/root --runroot /tmp/podman-e2e-2134768457/subtest-2968878380/runroot --runtime crun --conmon /usr/bin/conmon --network-config-dir /etc/containers/networks --network-backend netavark --cgroup-manager systemd --tmpdir /tmp/podman-e2e-2134768457/subtest-2968878380 --events-backend file --db-backend sqlite --storage-driver overlay pod rm -fa -t 0
    Running: /usr/bin/podman --storage-opt overlay.imagestore=/tmp/podman-e2e-2134768457/imagecachedir --root /tmp/podman-e2e-2134768457/subtest-2968878380/root --runroot /tmp/podman-e2e-2134768457/subtest-2968878380/runroot --runtime crun --conmon /usr/bin/conmon --network-config-dir /etc/containers/networks --network-backend netavark --cgroup-manager systemd --tmpdir /tmp/podman-e2e-2134768457/subtest-2968878380 --events-backend file --db-backend sqlite --storage-driver overlay rm -fa -t 0
    3f7501ec1389c8da7224ec95ec58cc4ad10c8334bfd082c7f7f271975f5c0d16
    < Exit [AfterEach] TOP-LEVEL - /root/podman-upstream/test/e2e/common_test.go:122 @ 10/07/24 04:51:30.514 (146ms)
    << Timeline
    ------------------------------
    ...snip...

Summarizing 1 Failure: [FAIL] Podman run with --sig-proxy [It] signals are not forwarded to container with sig-proxy false /root/podman-upstream/test/e2e/run_signal_test.go:115


### Describe the results you received

This test will output an error.
"Command exited with status %d (expected %d)", matcher.ExitCode, matcher.ExpectedExitCode

### Describe the results you expected

The test will end successfully if the exit status is 134 (128+6 SIGABRT).

### podman info output

# podman info

host: arch: amd64 buildahVersion: 1.37.3 cgroupControllers:

Podman in a container

No

Privileged Or Rootless

Privileged

Upstream Latest Release

Yes

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

Luap99 commented 3 days ago

The test is sending SIGFPE and that is causing golang to catch it and print SIGFPE: floating-point exception + stack trace and then exits 2. This works fine in all our CI systems and for me locally on f40.

There is nothing wrong with ExitWithError is simply check the exit code is what we expect, sending SIGABRT will also cause the podman process to exit 2 as this is also catched by golang.

So if you get anything else something seems to be wrong in your environment.