Nix Package Manager development | 859 Members | |
| For people hacking on Nix: https://github.com/NixOS/nix Nix maintainers can be reached here. | 185 Servers |
| Sender | Message | Time |
|---|---|---|
| 21 Oct 2025 | ||
no, --outputs will list all outputs of the derivation. --tree and --graph(ml) are basically recursive versions of --references which shows the inputs (but only shows 'derivation X depends on derivation Y', not 'derivation X depends on output Z of derivation Y') | 11:13:45 | |
| Hey there, I am currently investigating nix assertion errors that consistently appear once in a while in our CI. Only MacOS machines are affected by this and the error persists until the nix store is garbage collected. It also only persists on the same user on the machine.
This is the assertion that is violated though the check has since been moved in master. We currently run nix version 2.31.2. So essentially the two nix store paths differ due to existing and non-existing submodule directories, without their content and also somewhat their parent directory, see:
Does anybody see what could be wrong here or where to look for bugs in nix? I will probably continue to debug this, but there's a lot going on in nix that I am not aware of yet. | 13:29:59 | |
| Generally flake inputs with submodules should not be cached for this reason (the fetchToStore cache entry from the fingerprint -> store path). Maybe that’s the broken part? | 13:53:43 | |
| does it end up in the cache with submodules enabled and disabled? | 13:56:32 | |
| For the same git revision | 13:56:51 | |
| Sergei Zimmerman (xokdvium): What specifically do you mean with submodules enabled/disabled? And which cache specifically? | 13:57:38 | |
| The fetcher cache. | 13:58:44 | |
Sergei Zimmerman (xokdvium): Only the revision with no empty submodule directories is in the fetcher cache fetcher-cache-v4.sqlite. For the build to work, the store path should include empty submodule directories (or atleast for hashes to match). | 14:15:12 | |
| So I guess there must be some code that puts invalid entries into the fetcher cache? And this specifically only happens when the repository contains submodules that are not fetched? | 14:16:40 | |
In reply to @juliankuners:matrix.orgWhen submodules are fetched it should not try to use the fetcher cache at all. That’s the issue I think. There’s some logic for it there, but it must have been broken somehow | 14:17:59 | |
| (As in, it should not use the fetchToStore cache entry) | 14:18:27 | |
| Because submodules are wonky and caching them correctly in a way that the narHash stays the same is hard | 14:19:20 | |
| This must have surfaced because fetchToStore caching was broken for a while and only got fixed recently in https://github.com/NixOS/nix/pull/14050 | 14:20:54 | |
| Hmm, considering all the past CI issues, I think I spotted one point in CI logs where the issue starts happening, as it logs the additional Do you think this could populate the cache with an invalid entry? | 14:24:42 | |
| Thank you for these thoughts and hints. I guess I at least figured out the root cause now with this. | 14:25:52 | |
In reply to @juliankuners:matrix.orgHm, a local checkout might do that yeah. The git fetcher might consider it to be cacheable and doesn’t take into account empty subdirs | 14:27:23 | |
| As I am thinking about ways to work around this, I feel like all workarounds are very hacky. Is this wrong caching behaviour that I observed covered by the above mentioned PR? Or would it be an on-going issue without clear solution, because submodules are involved? Just wondering whether there's a feasible fix in the meantime or whether it's a bigger scale on-going issue. | 14:37:45 | |
In reply to @juliankuners:matrix.orgReasonably we could just avoid caching the fetchToStore entry if submodules are present in the local checkout. A more clever solution would be to filter out the empty subdirs for submodules when fetching to the store from a local checkout. The first solution seems more immediate and backportable. Submodules + caching is definitely an ongoing issue | 14:45:20 | |
| Re-looking at the CI logs, it's probably not immediately the checkout problem, as it the mis-cached repository is another repository and not the ceckout (that is also not a submodule or anything) :/. Sorry for the confusion. | 14:48:26 | |
| For clarification. The repositories have submodules, but none are used for nix flakes and derivations. | 14:49:13 | |
| I think I understand what’s going on. Will poke around soonish and see | 15:13:25 | |
Yea, me somwhat too. It is actually the checkout issue, but it's caused by a checkout of the mis-cached repository in another CI on the same CI machine, see here. The timestamp of the CI job and the cache entry in the sqlite database match exactly, same as the wrong nix store path 72alw9m62226brv4v4m98fqrk31mlp34. | 15:21:07 | |
| I created a respective issue, highlighting the I suppose actual root cause, all things considered https://github.com/NixOS/nix/issues/14317 | 17:03:51 | |
In reply to @juliankuners:matrix.orgoh yeah that's a duplicate of https://github.com/NixOS/nix/issues/13698 | 17:13:40 | |
| guess i was a few hours late to the discussion | 17:15:47 | |
| Thank you, I missed this one during my issue search. I closed it and linked to it in the respective other issue. | 17:19:57 | |
| 18:09:44 | ||
| 18:09:44 | ||
learned today that using std::string for large buffers is very inefficient (huge kernel overhead): https://github.com/DeterminateSystems/nix-src/pull/238/commits/edf45d6e1158a059e7ded5460d2a3947dc35fdf8 | 20:44:48 | |
| This is sort of more about doing unnecessary construction/destruction of an object. Not special to std::string in any way | 20:55:40 | |