containerd / nerdctl

contaiNERD CTL - Docker-compatible CLI for containerd, with support for Compose, Rootless, eStargz, OCIcrypt, IPFS, ...
Apache License 2.0
8.24k stars 612 forks source link

Is file-locking on windows currently broken? #3284

Closed apostasie closed 3 months ago

apostasie commented 3 months ago

Description

I have been scratching my head over suspicious CI failures that only affect Windows and that definitely involves volumes (hence file locking).

Closely reading source code, it looks like the behavior on unix is to lock exclusively:

https://github.com/containerd/nerdctl/blob/main/pkg/lockutil/lockutil_unix.go#L62

While on windows:

https://github.com/containerd/nerdctl/blob/main/pkg/lockutil/lockutil_windows.go#L54

We do not seem to request an exclusive lock (which would be LOCKFILE_EXCLUSIVE_LOCK = 2).

I will submit a PR now as this seems wrong - but I would like a confirmation from someone, as windows is not really my jam.

@AkihiroSuda opinion?

Steps to reproduce the issue

na

Describe the results you received and expected

na

What version of nerdctl are you using?

na

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

None

Host information

No response

apostasie commented 3 months ago

I am also confused at the values we are setting for nNumberOfBytesToLockLow and nNumberOfBytesToLockHigh.

Any idea why?

apostasie commented 3 months ago

Fixed by #3285