Skip to content

libexpr: rethrow failed realisation error - #16682

Open
DerDennisOP wants to merge 3 commits into
NixOS:masterfrom
DerDennisOP:realise-failure-memo
Open

DerDennisOP wants to merge 3 commits into
NixOS:masterfrom
DerDennisOP:realise-failure-memo

Conversation

@DerDennisOP

@DerDennisOP DerDennisOP commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

I run a small CI system. Many attributes of a flake import the same derivation. Attributes that import a failing derivation cause the store to build that derivation again. Importers each trigger one attempt for a broken derivation. Concurrent evaluator attempts serialize on the lock for a store output.

Context

The evaluator can now keep a copy of the exception for each EvalState and rethrow that copy for the rest of its lifetime. The evaluator can capture the copy before the exception propagates. Handlers add traces to a caught exception. Tests check that a replayed failure and the first failure have the same number of traces.

The changes sit atop #16677. The test store and its DummyStoreImpl header come from that PR.


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@DerDennisOP
DerDennisOP force-pushed the realise-failure-memo branch 2 times, most recently from 2abf39f to b9e7cdb Compare October 25, 2026 19:20
@github-actions github-actions Bot added the store Issues and pull requests concerning the Nix store label Oct 25, 2026
@DerDennisOP
DerDennisOP force-pushed the realise-failure-memo branch 2 times, most recently from 88f6058 to 1426643 Compare November 9, 2026 14:59
Dennis Wuitz added 2 commits November 9, 2026 16:07
A cached string's context paths each required one `isValidPath` call
from `getStringWithContext()`. Each path cost a daemon round-trip. The
function switched to `addTempRoot` for each path. Those calls
deduplicate per connection in `RemoteStore`. A single `queryValidPaths`
call can check all paths.
@DerDennisOP
DerDennisOP force-pushed the realise-failure-memo branch 2 times, most recently from fcec489 to cece21c Compare November 9, 2026 15:47
Attributes that import the same failing derivation ask the store to build that derivation again. Many attributes import the same broken derivation. These importers cause one attempt each. The output lock of the store serialized concurrent evaluator attempts.

Build with `buildPathsWithResults`. Save a copy of the build error for each derivation that failed alone. Reasons include failure of the builder, rejection of inputs or outputs, hash mismatch and log limit. Same for a timeout. A second attempt can wait for the full timeout again. Rethrow that copy rather than rebuild. Rebuild transient failures such as network errors from a substituter, dependency failure and loss of the daemon connection. The `:reload` command in the REPL can call `resetFileCache()`. Stored failures disappear after `resetFileCache()`.
@DerDennisOP DerDennisOP changed the title libexpr: replay a failed realisation instead of building it again libexpr: rethrow failed realisation error Nov 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

store Issues and pull requests concerning the Nix store

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant