-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
'Gracefully' fallback from failing substituters #13301
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| #include "nix/util/logging.hh" | ||
| #include "nix/util/signature/local-keys.hh" | ||
| #include "nix/util/source-accessor.hh" | ||
| #include "nix/store/globals.hh" | ||
|
|
@@ -392,11 +393,14 @@ void Store::querySubstitutablePathInfos(const StorePathCAMap & paths, Substituta | |
| { | ||
| if (!settings.useSubstitutes) | ||
| return; | ||
| for (auto & sub : getDefaultSubstituters()) { | ||
| for (auto & path : paths) { | ||
| if (infos.count(path.first)) | ||
| // Choose first succeeding substituter. | ||
| continue; | ||
|
Comment on lines
-397
to
-399
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think it'd make more sense to put a break at L435 https://github.com/NixOS/nix/pull/13301/changes/BASE..11d7c80370a01e96bceb9dbe5124d3e91c841c7d#diff-e89a2224d1d4c39bf5a2d448b7b2fac1e3e75c7e08e414ee448846266c8bfeabL435
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| for (auto & path : paths) { | ||
| std::optional<Error> lastStoresException = std::nullopt; | ||
| for (auto & sub : getDefaultSubstituters()) { | ||
|
jadewilk marked this conversation as resolved.
|
||
| if (lastStoresException.has_value()) { | ||
| logError(lastStoresException->info()); | ||
| lastStoresException.reset(); | ||
| } | ||
|
|
||
| auto subPath(path.first); | ||
|
|
||
|
|
@@ -437,12 +441,15 @@ void Store::querySubstitutablePathInfos(const StorePathCAMap & paths, Substituta | |
| } catch (InvalidPath &) { | ||
| } catch (SubstituterDisabled &) { | ||
| } catch (Error & e) { | ||
| if (settings.tryFallback) | ||
| logError(e.info()); | ||
| else | ||
| throw; | ||
| lastStoresException = std::make_optional(std::move(e)); | ||
| } | ||
| } | ||
| if (lastStoresException.has_value()) { | ||
| if (!settings.tryFallback) { | ||
| throw *lastStoresException; | ||
| } else | ||
| logError(lastStoresException->info()); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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 we want this, the saving exception thing should just be for the no-fallback case, right?
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.
oh my bad, I think I am wrong and this is fine. You tell can confirm, though.
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 there has been some confusion when implementing this loop that means tryFallback has been coerced into meaning both "try the next substituter" and "try building the path ourselves" - I am quite sure it should only be used for the latter. Otherwise... that would mean we are ok with trying the next substituter if the first one doesn't have a path, but not if it errors out and gets disabled... really weird.
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.
There was some other PR where I left a big comment trying to explain the theory.
Here's what I think: "!tryFallback" is a coherence trick: you only build/use a substituter if you are sure that the previous substituters don't have the store object in question. If you can access them and they don't have it, you are sure. If you can't access it, you don't know, and thus you could be getting/build the "wrong version".
That actually would be a reason to have what I wrote above.
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.
#7188 (comment) ah this is the comment I had in mind
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.
perhaps im ignorant, but in what case could we get a path that has different versions depending on the substituter used, would this not result in a different path entirely?
I don't think the state of the substituter should affect the contents of the path we get back?
Uh oh!
There was an error while loading. Please reload this page.
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.
With input-addressing, the a store path may be allowed to point to different contents if the derivation is non-deterministic.