-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix misread of source if path is already valid #7720
Fix misread of source if path is already valid #7720
Conversation
Can you give more information on how to reproduce this? In the (current) daemon protocol, NARs are supposed to be wrapped in a |
We could reproduce it consistently by running two One succeeds and the other one gets the The full command was |
It is not really an incomplete NAR parsing as much as a completely absent one. Would a |
I'm actually not surprised at all (in hindsight, I have to admit I totally overlooked this): This bug had already been reported in the general case (#6730) and fixed (although I apparently forgot to close the issue) while I rewrote the implementation of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's very sensible 👍
Apart from the small code comment, do you have an easy self-contained reproducer for this? It would be nice to add as a test case
I think the real bug here is that |
When receiving a stream of NARs through the ssh-ng protocol, an already existing path would cause the NAR archive to not be read in the stream, resulting in trying to parse the NAR as a ValidPathInfo. This results in the error message: error: not an absolute path: 'nix-archive-1' Fixes NixOS#6253 Usually this problem is avoided by running QueryValidPaths before AddMultipleToStore, but can arise when two parallel nix processes gets the same response from QueryValidPaths. This makes the problem more prominent when running builds in parallel.
3e8062c
to
ff81d84
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-44/25546/1 |
@simonrainerson Do you think you can turn #7720 (comment) into a proper test? The PR is good for me otherwise, but I'd really like this to be a bit more properly tested if that can be done |
I'm not very familiar with the code so If you have any pointer to how to set up a LocalStore in a test that would be helpful. Then I think it would pretty straight forward to test for. |
You can use |
@simonrainerson I've rebased your branch and added a test on https://github.com/tweag/nix/fix-add-to-store-existing. Do you want to incorporate that into this PR? Or I can open a new one if you don't want to bother with it |
I get a 404 from that link, feel free to open a pr if you want. I'm back at my computer at the end of the week (or start of next) and can update this PR then. Thanks either way! |
My bad, the correct link is https://github.com/tweag/nix/tree/fix-add-to-store-existing. I've opened #8805 as a rebased-version of this one. Should auto-merge once the CI is done running. Thanks! |
Motivation
When receiving a stream of NARs through the ssh-ng protocol, an already existing path would cause the NAR archive to not be read in the stream, resulting in trying to parse the NAR as a ValidPathInfo. This results in the error message:
Context
Usually this problem is avoided by running QueryValidPaths before AddMultipleToStore, but can arise when two parallel nix processes gets the same response from QueryValidPaths. This makes the problem more prominent when running builds in parallel.
Fixes #6253
Checklist for maintainers
Maintainers: tick if completed or explain if not relevant
tests/**.sh
src/*/tests
tests/nixos/*