Skip to content

Concurrent same-name creates can both fail and remove the destination #30

Description

@gpu004

What I observed

Two concurrent creates with the same name can both fail and leave no destination or child registry row.

Reproduction

I initialized a fresh source containing file.txt, then started these commands concurrently against the same database:

target/debug/rift --database "$db" create "$source" --name same >a.out 2>a.err &
a_pid=$!
target/debug/rift --database "$db" create "$source" --name same >b.out 2>b.err &
b_pid=$!
wait "$a_pid"; a_status=$?
wait "$b_pid"; b_status=$?

printf 'A=%s B=%s\n' "$a_status" "$b_status"
cat a.err b.err
test -e "$destination"; echo "destination exists: $?"
sqlite3 "$db" 'select count(*) from rift where parent_id is not null;'

One failing pair produced:

File exists (os error 17)
copy-on-write cloning unavailable: failed to clone .../source/file.txt: No such file or directory (os error 2)

Both statuses were nonzero, the destination was absent, and the database had no child row. Across three runs of 100 fresh pairs, I reproduced that outcome 28, 54, and 49 times, 131 of 300 pairs total.

Expected

One create succeeds and the other reports a collision, leaving one complete destination and one child registry row.

Actual

Both creates can fail, and cleanup removes the destination produced during the race.

Environment

  • Rift commit 757a22cb247f
  • macOS 26.6.2, arm64, APFS

Activity

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