Skip to content

local-binary-cache-store upsertFile not concurrency-safe #3695

@Ericson2314

Description

@Ericson2314

Describe the bug

When the same nar is to be uploaded multiple times (I think via dependencies), the concurrent writes/renames will conflict and failures may occur.

Steps To Reproduce

Still working on this. I did add a bunch of logging and observed the concurrency of multiple atomicWrite calls.

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

Everything is written without errors, redundant nar upserts either do nothing or replace the existing nar.

nix-env --version output

Master branch

Additional context

atomicWrite in src/libstore/local-binary-cache-store.cc uses process ids for temporary files, but I think it needs to use something finer-grained to distinguish threads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions