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

The Nix daemon crashes when started without --experimental-features ca-derivations, but a client tries to force it #5017

Closed
thufschmitt opened this issue Jul 15, 2021 · 3 comments · Fixed by #5071
Assignees
Labels
bug ca-derivations Derivations with content addressed outputs

Comments

@thufschmitt
Copy link
Member

Describe the bug

(privileged) clients can enable some experimental features on the daemon they talk to. This is generally fine, except for the ca-derivations which will cause the daemon to crash with something like src/libstore/sqlite.cc:92: nix::SQLiteStmt::Use::Use(nix::SQLiteStmt&): Assertion stmt.stmt' failed`.

Steps To Reproduce

  • Start the Nix daemon without the ca-derivations experimental feature
  • Run a (privileged) build with --extra-experimental-features ca-derivations

Expected behavior

Ideally this should transparently work as expected.
This might be a bit tricky because of the DB schema constraints, but we should at least yield a proper error in that case.

Additional context

The underlying issue is that enabling ca-derivations changes the underlying db schema (which can only happen at the begining of the process when we open the DB).
Then some precompiled SQL queries in LocalStore depend on the ca-specific schema, so they are left undefined if the experimental-feature isn’t set (here).
In a “normal” setting, this is fine because we’ll never use these as ca-derivations isn’t set. But since the client can enable the feature after-the-fact, we end-up using it anyways, leading to the assertion failure (which is mostly a glorified null pointer exception)

@thufschmitt thufschmitt added bug ca-derivations Derivations with content addressed outputs labels Jul 15, 2021
@thufschmitt thufschmitt self-assigned this Jul 15, 2021
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/content-addressed-nix-call-for-testers/12881/119

@edolstra
Copy link
Member

Probably the daemon should ignore the experimental-features setting sent by the client.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/content-addressed-nix-call-for-testers/12881/129

thufschmitt added a commit that referenced this issue Jul 30, 2021
The experimental features are, well, experimental, and shouldn’t be
carelessly and transparently enabled.
Besides, some (`ca-derivations` at least) need to be enabled at startup
in order to work properly.
So it’s better to just require that daemon be started with the right
`experimental-features` option.

Fix #5017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ca-derivations Derivations with content addressed outputs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants