Skip to content

worker: volume sweeper removes overlay dirs of volumes being created, breaking container create #9685

Closed

Description

@JanZachmann

Summary

The volume sweeper can delete the overlay dirs of a volume that is being created at that moment. The volume stays mounted, but creating a file in it then fails with ENOENT, so the container create on that volume dies with:

find or create container on worker <id>: starting task: new task: failed to create shim task: OCI runtime create failed:
runc create failed: unable to start container process: error during container init: error mounting
"/usr/local/concourse/bin/init" to rootfs at "/tmp/gdn-init": create mountpoint for /tmp/gdn-init mount:
make mountpoint "/tmp/gdn-init": openat gdn-init: no such file or directory

We get this about 4 times a day. Most hits are resource check containers, which run again on their own, but a hit on a step of a job errors the whole build.

Steps to Reproduce

Hard to trigger on purpose, the window is a few milliseconds per sweep. We ran the worker at debug level and captured 2 minutes of log around each failure. In 8 captures, all 9 failures were preceded by an orphan removal of the same handle, out of ~1200 create-cow with only 10 orphan removals in total.

One of them:

02:08:26.141 volume-server.cleanup-orphaned-volumes.start
02:08:26.143 overlay-driver.creating-overlay-mount        upperdir=/worker-state/overlays/27c32ab5-...
02:08:26.144 overlay-driver.removing-orphaned-overlay-work-dir  handle=27c32ab5-...
02:08:26.144 volume-server.cleanup-orphaned-volumes.done
02:08:27.966 garden-server.create.failed                  openat gdn-init: no such file or directory

CleanupOrphanedEntries() reads live/ and init/ into knownHandles, then RemoveOrphanedResources() lists overlays/ and overlays/work/ and removes everything that is not in that snapshot. Two ways to fall through it:

  • creation: initRawVolume() creates init/<handle> before the driver creates the overlay dirs, so a volume created after the snapshot is missing from it and loses its work dir.
  • promotion: Initialize() renames init/<handle> to live/<handle>. A snapshot taken during the rename finds the handle in neither dir, and the whole layer is removed.

We see both: 4 of the 9 are work-dir removals with the overlay mount inside the sweep window, 5 are layer removals 1-5 ms after filesystem.init-volume. In every case the removal comes after the volume's own creating-overlay-mount, and neighbouring volumes mounted a few ms earlier or later are fine.

The ENOENT can be reproduced without Concourse:

mount -t overlay overlay -o lowerdir=$B/lower,upperdir=$B/upper,workdir=$B/work $B/merged
rm -rf $B/work
touch $B/merged/tmp/gdn-init   # No such file or directory, while ls $B/merged/tmp still works

Same result when upperdir and workdir are both removed. That is what runc hits: the init binary is a file, so runc creates the mountpoint with O_CREAT|O_EXCL inside the rootfs.

Expected Results

A volume created or promoted while a sweep is running keeps its overlay dirs.

Actual Results

Its layer or work dir is removed, the overlay is broken while mounted, and the container create fails.

Worker(s) configuration

One worker, containerd runtime, overlay driver, CONCOURSE_CONTAINERD_MAX_CONTAINERS=0, default sweep interval of 30s, a few hundred containers at a time.

Concourse Version

8.2.3. volume/filesystem.go and volume/driver/overlay_linux.go are identical in 8.2.4, 8.3.0 and master, so it should still be there.

Did this use to work?

Yes. RemoveOrphanedResources does not exist in 8.0.0, it came in 8.1.0.

Possible fix

Drop the snapshot and let the driver ask at removal time, e.g. pass isKnown func(handle string) bool instead of the map, which stats init/<handle> first and live/<handle> second. That order is safe against the rename: the entry is always in one of the two, and the live check happens after the init check, so it cannot miss both.

Activity

  1. taylorsilva commented on Aug 17, 2026

    @taylorsilva
    Member

    Thanks for the detailed report! Not seeing this one as much as you but I have seen this error. Putting it in the backlog to fix. TY!

  2. added this to the v8.4.0 milestone on Aug 17, 2026
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

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions