Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Ericson2314 opened this issue Jun 13, 2020 · 4 comments
Open

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

Ericson2314 opened this issue Jun 13, 2020 · 4 comments

Comments

@Ericson2314
Copy link
Member

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.

Ericson2314 added a commit to obsidiansystems/nix that referenced this issue Jun 13, 2020
@Ericson2314
Copy link
Member Author

CC @matthewbauer

@Ericson2314
Copy link
Member Author

Based on what I did in obsidiansystems@953ceba, it looks like one trigger is copying a fixed output derivation along with another that depends on the first one.

@matthewbauer
Copy link
Member

Is it actually atomicWrite that’s messed up or maybe just the init that’s not being called?

@stale
Copy link

stale bot commented Feb 13, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants