Skip to content

Disk cache commit reports success after unsuccessful publication #3

Open

Description

@morluto

DiskCacheEntry::commit() treats every failed rename as a competing writer successfully publishing the entry. If the destination is incomplete, it deletes the completed temporary build and returns the incomplete destination with hit and committed set to true. A permission failure can return a path that does not exist at all.

Reproduced at 8b3ef868705a3792cc1a14ab570b539f72fd3d94 on Linux:

  1. Obtain a cache miss and write a payload into entry.path.
  2. Create entry.commit_path with a partial file and no .committed marker.
  3. Call entry.commit(). Renaming over the nonempty destination fails.
  4. The call nevertheless returns that destination as successful, and the temporary payload is gone.

Repeating the operation against the same incomplete destination fails the same way. Denying write permission on the destination parent also produces false success. Normal publication and reuse of a competing committed entry pass their control cases.

Expected: reuse the destination only when a committed entry is visible there. Otherwise report the original rename error and keep the temporary build available for retry or cleanup when the entry is destroyed. After a failed rename, leave the incomplete destination untouched.

The unchecked fallback is in DiskCacheEntry::commit. It affects both backends through the shared runtime: compile_without_load() can return an invalid artifact path, while compile() subsequently fails loading the binary.

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