8000 ci: nightly file-locking tests on NFS and in containers · Issue #324 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

ci: nightly file-locking tests on NFS and in containers #324

Closed

Description

@adityamukho

Summary

Add a nightly workflow that tests file-locking behaviour in environments the
per-PR suite cannot reach. Follow-up to the kernel-locking rework that closes
#317; that PR carries the core fix plus the PID-namespace regression test, and
deliberately leaves these two environment tiers to a separate change.

Background

#317 was a PID-namespace bug. The fix replaces the PID sidecar with
std::fs::File::try_lock, so the kernel owns liveness and a dead holder's lock
is released automatically.

The per-PR suite covers PID namespaces directly, using unshare --pid --fork --mount-proc to put two processes at PID 1 in separate namespaces. That
reproduces #317 in about three seconds with no container runtime. What it cannot
cover is how kernel locks behave on a network filesystem.

Why NFS is the real gap

flock over NFS is emulated by fcntl on Linux since 2.6.37. This works on
NFSv4, but NFSv3 needs lockd. The failure mode that matters is a lock that
silently no-ops rather than returning an error: the new code would believe
it holds an exclusive lock while a second process holds the same file, which is
precisely the cross-process corruption the lock exists to prevent.

Nothing in the per-PR suite can detect this, and the RWX-volume deployments in
the #317 report (NFS, EFS, CephFS, Azure Files) are exactly where it would bite.

Tasks

  • New workflow (nightly schedule + workflow_dispatch)
  • NFS job — nfs-kernel-server on the runner, loopback export, run the
    lock suite over NFSv4 and over NFSv3-without-lockd. Assert that a lock is
    either genuinely exclusive or refused with an error. A silent no-op must
    fail the build.
  • Confirm the allow_unlocked fail-closed branch actually fires on a mount
    that cannot lock, rather than the lock quietly succeeding.
  • Docker job — two containers sharing a volume, matching the deployment
    shape in the original report. Small, and rides in the same workflow.

Notes

Kubernetes (kind/k3s) was considered and rejected during design. Pod
lifecycle reduces to SIGKILL plus a fresh PID-1 process, 8000 which the per-PR test
already covers, and kind provisions hostPath rather than NFS — so it would
add several minutes of setup and a flakiness source without exercising the RWX
semantics that motivate it. Reasoning is recorded in
docs/superpowers/specs/2026-08-22-kernel-file-locking-design.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0