nerdctl icon indicating copy to clipboard operation
nerdctl copied to clipboard

[LOGS]: on windows, logs do not show up / are extremely slow?

Open apostasie opened this issue 7 months ago • 3 comments

Description

TestLogsWithFailingContainer has been failing repeatedly on windows (for eg in #4209 )

What this test does is:

nerdctl run --name foo busybox sh -euxc "echo foo; echo bar; exit 42; echo baz"

Then:

sleep 5

Still:

nerdctl logs foo

will very often return nothing.

5 seconds feels like a very long time - even in a highly parallel context.

Also, this does not happen on linux.

There seem to be something different with Windows, where logs take much longer to show up. Note that this also happen on other tests.

@fahedouch are we missing sync on windows, or something like that?

Any idea why windows would be different?

Steps to reproduce the issue

Describe the results you received and expected

na

What version of nerdctl are you using?

main

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

Host information

No response

apostasie avatar May 09 '25 22:05 apostasie

This is also happening on TestLogsOutStreamsSeparated (and probably just any log test for windows).

Note that none of it is about waiting for a container started with -d. All these failures are containers running and finishing in one command, with seemingly nothing in the logs.

apostasie avatar May 10 '25 19:05 apostasie

This is not only Windows.

#4326 just hit this.

https://github.com/containerd/nerdctl/actions/runs/15777183949/job/44474557265?pr=4326

Container does run AND echo what it should.

 container_logs_test.go:248: 
        
        +------------------------------------------------------------------------------------------------------------+
        | ➡️      | ⚙️ /usr/local/bin/nerdctl run --name testlogswithfailingcontainer-d19fdff4 ghcr.io/stargz-contai |
        |         | ners/alpine:3.13-org sh -euxc echo foo; echo bar; exit 42; echo baz                              |
        +------------------------------------------------------------------------------------------------------------+
        |         | 🚫 command returned a non-zero exit code                                                         |
        +------------------------------------------------------------------------------------------------------------+
        |         | ⚠️ 42                                                                                            |
        +------------------------------------------------------------------------------------------------------------+
        |         | 🟢 foo                                                                                           |
        |         | bar                                                                                              |
        +------------------------------------------------------------------------------------------------------------+
        |         | 🟠 + echo foo                                                                                    |
        |         | + echo bar                                                                                       |
        |         | + exit 42                                                                                        |
        +------------------------------------------------------------------------------------------------------------+
        | 🌱      | XDG_SESSION_TYPE=tty                                                                             |
        |         | HOME=/home/rootless                                                                              |
        |         | XDG_SESSION_CLASS=user                                                                           |
        |         | XDG_SESSION_ID=3                                                                                 |
        |         | XDG_RUNTIME_DIR=/run/user/1000                                                                   |
        |         | PATH=/usr/local/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin |
        |         | :/bin:/usr/games:/usr/local/games:/snap/bin                                                      |
        |         | DOCKER_CONFIG=/tmp/TestLogsWithFailingContainer1882762106/003                                    |
        |         | NERDCTL_TOML=/tmp/TestLogsWithFailingContainer1882762106/003/nerdctl.toml                        |
        +------------------------------------------------------------------------------------------------------------+
        | ⏰      | <1s (limit: 3m0s)                                                                                |
        +------------------------------------------------------------------------------------------------------------+
        | 📁      | /tmp/TestLogsWithFailingContainer1882762106/002                                                  |
        +------------------------------------------------------------------------------------------------------------+

But there is nothing in the logs:

container_logs_test.go:257: 
        
        +------------------------------------------------------------------------------------------------------------+
        | ➡️      | ⚙️ /usr/local/bin/nerdctl logs testlogswithfailingcontainer-d19fdff4                             |
        +------------------------------------------------------------------------------------------------------------+
        |         | 🟠 + echo foo                                                                                    |
        |         | + echo bar                                                                                       |
        |         | + exit 42                                                                                        |
        +------------------------------------------------------------------------------------------------------------+
        | 🌱      | XDG_SESSION_TYPE=tty                                                                             |
        |         | HOME=/home/rootless                                                                              |
        |         | XDG_SESSION_CLASS=user                                                                           |
        |         | XDG_SESSION_ID=3                                                                                 |
        |         | XDG_RUNTIME_DIR=/run/user/1000                                                                   |
        |         | PATH=/usr/local/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin |
        |         | :/bin:/usr/games:/usr/local/games:/snap/bin                                                      |
        |         | DOCKER_CONFIG=/tmp/TestLogsWithFailingContainer18[827](https://github.com/containerd/nerdctl/actions/runs/15777183949/job/44474557265?pr=4326#step:10:828)62106/003                                    |
        |         | NERDCTL_TOML=/tmp/TestLogsWithFailingContainer1882762106/003/nerdctl.toml                        |
        +------------------------------------------------------------------------------------------------------------+
        | ⏰      | <1s (limit: 3m0s)                                                                                |
        +------------------------------------------------------------------------------------------------------------+
        | 📁      | /tmp/TestLogsWithFailingContainer1882762106/002                                                  |
        +------------------------------------------------------------------------------------------------------------+
        
    container_logs_test.go:257: 	🔗 
        
        <<<<<<<<<<<<<<<<<<<<
        	🖊️ Inspecting output (equals)
        	👀 testing:		``
        	❌ FAILED!		= `foo
        bar
        `
        >>>>>>>>>>>>>>>>>>>>

@fahedouch do we have some serious problem with logs?

apostasie avatar Jun 20 '25 17:06 apostasie

Ok. I will try to find some time to check the logging workflow

fahedouch avatar Jun 20 '25 18:06 fahedouch