Skip to content

fix: logs updated on starting of a stopped container #3896

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

Merged
merged 1 commit into from
May 7, 2025

Conversation

Shubhranshu153
Copy link
Contributor

@Shubhranshu153 Shubhranshu153 commented Feb 18, 2025

Issue:

When we start a container that was running and stopped or exited, logs are not updated.

Steps to Reproduce:

step 1: Run and exit container

sudo nerdctl run -it --name test-1 alpine:latest
/ # echo hello
hello
/ # exit
  1. start the same container
 sudo nerdctl start -a test-1
/ # echo bar
bar
/ # exit
  1. Check logs. Bar is missing.
 sudo nerdctl logs test-1
/ # echo hello
hello
/ # exit

fix:

The pr fixes it by adding multiwriters to start of containers.

Interactive Flag Added to start

Nerdctl didn't support interactive flag so added the flag to have compatible behavior with docker

@Shubhranshu153 Shubhranshu153 force-pushed the fix-logs-on-attach branch 6 times, most recently from 49019a2 to ccb179d Compare February 18, 2025 09:03
@Shubhranshu153
Copy link
Contributor Author

@AkihiroSuda
PTAL when you get a chance.
Thank You.

@apostasie
Copy link
Contributor

Docker failure is #3908

Rootful failure is #3513

@apostasie
Copy link
Contributor

@Shubhranshu153 I just have a batch of nits on the test.

Btw, feedback on the test framework is highly welcome.

Ideally, if we get #3591 in first, we can get rid of the added DelayOnceReaders here (and unbuffer).

But anyhow, don't sweat it - I can clean that up afterwards if needed.

@Shubhranshu153 Shubhranshu153 force-pushed the fix-logs-on-attach branch 3 times, most recently from df70bc7 to 72193e6 Compare February 24, 2025 18:20
@AkihiroSuda AkihiroSuda added this to the v2.0.5 milestone Apr 21, 2025
@AkihiroSuda AkihiroSuda modified the milestones: v2.0.5, v2.1.0 May 1, 2025
@AkihiroSuda
Copy link
Member

Needs rebase

@Shubhranshu153 Shubhranshu153 force-pushed the fix-logs-on-attach branch 3 times, most recently from 2c39201 to 65616d7 Compare May 1, 2025 21:59
@Shubhranshu153 Shubhranshu153 force-pushed the fix-logs-on-attach branch 3 times, most recently from 9b25406 to 8a8f662 Compare May 2, 2025 00:25
@Shubhranshu153 Shubhranshu153 reopened this May 2, 2025
@Shubhranshu153
Copy link
Contributor Author

         | ➡️      | ⚙️ /usr/local/bin/nerdctl.gomodjail info -f {{.Driver}}                                          |
        +------------------------------------------------------------------------------------------------------------+
        |         | 🚫 command returned a non-zero exit code                                                         |
        +------------------------------------------------------------------------------------------------------------+
        |         | ⚠️ 1                                                                                             |
        +------------------------------------------------------------------------------------------------------------+
        |         | 🟠 time=2025-05-05T03:27:52.617Z level=ERROR msg="exiting with an error" error="open /home/rootl |
        |         | ess/.cache/gomodjail/1f381f194c295770/go.mod: no such file or directory"

this seems like an error regarding go mod jail? Not sure why go.mod is read during runtime.

@apostasie
Copy link
Contributor

         | ➡️      | ⚙️ /usr/local/bin/nerdctl.gomodjail info -f {{.Driver}}                                          |
        +------------------------------------------------------------------------------------------------------------+
        |         | 🚫 command returned a non-zero exit code                                                         |
        +------------------------------------------------------------------------------------------------------------+
        |         | ⚠️ 1                                                                                             |
        +------------------------------------------------------------------------------------------------------------+
        |         | 🟠 time=2025-05-05T03:27:52.617Z level=ERROR msg="exiting with an error" error="open /home/rootl |
        |         | ess/.cache/gomodjail/1f381f194c295770/go.mod: no such file or directory"

this seems like an error regarding go mod jail? Not sure why go.mod is read during runtime.

It is (AkihiroSuda/gomodjail#50).

Gomodjail errors can be ignored for now.

@Shubhranshu153
Copy link
Contributor Author

Flaky Test PR's:
#4196
#4198
#4199

@Shubhranshu153
Copy link
Contributor Author

Rerunning the test for flaky test.

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit 91739b7 into containerd:main May 7, 2025
159 of 164 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants