rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.99k stars 283 forks source link

nerdctl: failed to write to log: file already closed, when restarting container after existing (containerd) #7171

Closed rklec closed 3 months ago

rklec commented 3 months ago

Actual Behavior

After restarting Rancher an error pops up when I try to start a previously running container. It's hard to copy as it's really just a dialog, but it says something about a file being closed. I cannot even read the whole text as part of the hash at the end just is too big for the dialog and abbreviated.

Steps to Reproduce

Because of https://github.com/rancher-sandbox/rancher-desktop/issues/7169#issuecomment-2218367599 I have exited Rancher (took 5 seconds to end) and restarted it. It worked, the container that was previously running was stopped (aka just "created"), but I got the following error when I tried starting it via Rancher:

Obviously after the setup was done (as in the other issue), I created the container manually from the command line (nerdctl run rabbitmq), as I could not find a Rancher feature for this (which is confusing, but okay, still, in development I guess). Otherwise there would be no container.

Result

grafik

OCR'ed:

level=fatal msg:: "1 errors:\nfailed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook error running hook: exit status 1, stdout: , stderr: level=fatal to call cniSetup: plugin failed (add): failed to allocate for range O: 10.4.02 has been allocated to default-41be4c1 eb78b8U143c56a470a56435218.39285aadb343568ßa7bfe227ag19, duplicate allocation is not to write to log, write /va r/lib/nerdctl/ dbb 1 gc5e/ containers/ defa ult/41 be4c1 eb78b884143c56a470a 56435218839285aadb34.„ file already closed: unknown"

grafik

Expected Behavior

Start container?

Write to log always?

Additional Information

The weird thing is, not a lot has been logged at this point:

> ls

    Verzeichnis: *****\AppData\Local\rancher-desktop\logs

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        09.07.2024     20:18           2062 background.log
-a----        09.07.2024     20:18              0 commandLine.log
-a----        09.07.2024     20:18              0 dashboardServer.log
-a----        09.07.2024     20:18              0 deploymentProfile.log
-a----        09.07.2024     20:18            141 diagnostics.log
-a----        09.07.2024     20:19            215 extensions.log
-a----        09.07.2024     20:18            848 host-switch.log
-a----        09.07.2024     20:18              0 images.log
-a----        09.07.2024     20:19            553 integrations.log
-a----        09.07.2024     20:18            193 k8s.log
-a----        09.07.2024     20:18              0 kube.log
-a----        09.07.2024     20:18              0 lima.log
-a----        09.07.2024     20:18              0 moby.log
-a----        09.07.2024     20:18              0 mock.log
-a----        09.07.2024     20:18              0 nerdctl.log
-a----        09.07.2024     20:18            625 network-setup.log
-a----        09.07.2024     20:18              0 networking-ca.log
-a----        09.07.2024     20:18              0 networking.log
-a----        09.07.2024     20:18              0 protocol-handler.log
-a----        09.07.2024     20:21            614 rancher-desktop-guestagent.log
-a----        09.07.2024     20:18            110 server.log
-a----        09.07.2024     20:18             47 settings.log
-a----        09.07.2024     20:18           1522 shortcuts.log
-a----        09.07.2024     20:18              0 snapshots.log
-a----        09.07.2024     20:18              0 steve.log
-a----        09.07.2024     20:22            334 update.log
-a----        09.07.2024     20:18             73 vm-switch.log
-a----        09.07.2024     20:18              0 window_browser.log
-a----        09.07.2024     20:18          40088 wsl-exec.log
-a----        09.07.2024     20:19            204 wsl-helper.Ubuntu.log
-a----        09.07.2024     20:18           2364 wsl-init.log
-a----        09.07.2024     20:18              0 wsl-version.log
-a----        09.07.2024     20:18            949 wsl.log

host-switch.log:

time="2024-07-09T20:18:54+02:00" level=info msg="successfully estabilished a handshake with a peer: 48b7ebae-da49-4b92-94ee-31f889238512"
time="2024-07-09T20:18:54+02:00" level=info msg="successful handshake, waiting for a vsock connection from VMGUID: 48b7ebae-da49-4b92-94ee-31f889238512 on Port: 6656"
time="2024-07-09T20:18:54+02:00" level=info msg="attempt to handshake with [48b7ebae-da49-4b92-94ee-31f889238512], goroutine is terminated"
time="2024-07-09T20:18:54+02:00" level=info msg="waiting for clients..."
time="2024-07-09T20:18:54+02:00" level=info msg="port forwarding API server is running on: 192.168.127.1:80"
time="2024-07-09T20:18:54+02:00" level=info msg="new connection from 48b7ebae-da49-4b92-94ee-31f889238512:181b2e3d-facb-11e6-bd58-64006a7986d3 to 48b7ebae-da49-4b92-94ee-31f889238512:00001a00-facb-11e6-bd58-64006a7986d3"

background.log:

2024-07-09T18:18:24.334Z: Stopping background process Win32 socket proxy (pid <none>).
2024-07-09T18:18:30.587Z: mainEvents settings-update: {"version":11,"application":{"adminAccess":false,"debug":false,"extensions":{"allowed":{"enabled":false,"list":[]},"installed":{}},"pathManagementStrategy":"manual","telemetry":{"enabled":false},"updater":{"enabled":true},"autoStart":false,"startInBackground":false,"hideNotificationIcon":false,"window":{"quitOnClose":false}},"containerEngine":{"allowedImages":{"enabled":false,"patterns":[]},"name":"containerd"},"virtualMachine":{"memoryInGB":2,"numberCPUs":2,"hostResolver":true},"WSL":{"integrations":{"Ubuntu":true}},"kubernetes":{"version":"1.29.5","port":6443,"enabled":false,"options":{"traefik":true,"flannel":true},"ingress":{"localhostOnly":false}},"portForwarding":{"includeKubernetesServices":false},"images":{"showAll":true,"namespace":"default"},"containers":{"showAll":true,"namespace":"default"},"diagnostics":{"showMuted":false,"mutedChecks":{}},"experimental":{"containerEngine":{"webAssembly":{"enabled":false}},"kubernetes":{"options":{"spinkube":false}},"virtualMachine":{"type":"qemu","useRosetta":false,"socketVMNet":false,"mount":{"type":"reverse-sshfs","9p":{"securityModel":"none","protocolVersion":"9p2000.L","msizeInKib":128,"cacheMode":"mmap"}},"networkingTunnel":true,"proxy":{"enabled":false,"address":"","password":"","port":3128,"username":"","noproxy":["0.0.0.0/8","10.0.0.0/8","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.168.0.0/16","224.0.0.0/4","240.0.0.0/4"]}}}}
2024-07-09T18:18:30.622Z: Stopping background process Win32 socket proxy (pid <none>).
2024-07-09T18:18:35.160Z: Stopping background process Win32 socket proxy (pid <none>).
2024-07-09T18:18:35.327Z: Stopping background process host-resolver vsock host (pid <none>).
2024-07-09T18:18:35.327Z: Stopping background process host-switch.exe (pid <none>).
2024-07-09T18:18:38.099Z: Launching background process host-switch.exe.
2024-07-09T18:18:59.829Z: Stopping background process Win32 socket proxy (pid <none>).

These are the whole files. I especially cannot find anything about the error message it showed to me. nerdctl.log is indeed empty.

It's reproducible at this startup (tried twice).

Rancher Desktop Version

1.14.1

Rancher Desktop K8s Version

dunno

Which container engine are you using?

containerd (nerdctl)

What operating system are you using?

Windows

Operating System / Build Version

Windows 10 Enterprise Version 22H2 build 19045.4529

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

see issue https://github.com/rancher-sandbox/rancher-desktop/issues/7169 for more system details

rklec commented 3 months ago

Okay it was a onetime incident, at the next restart it worked again.

jandubois commented 3 months ago

Looks like a duplicate of #1600