Skip to content

feat: make cycle errors more verbose#6585

Closed
milahu wants to merge 4 commits intoNixOS:masterfrom
milahu:feat-cycle-errors-verbose
Closed

feat: make cycle errors more verbose#6585
milahu wants to merge 4 commits intoNixOS:masterfrom
milahu:feat-cycle-errors-verbose

Conversation

@milahu
Copy link
Contributor

@milahu milahu commented May 27, 2022

fix #481

with no cycle error, this has the same performance as the original code

on cycle error, catch the exception and do a second scan, to find hashes and expand them to filepaths

todo

  • make the exception-catching more specific
  • implement buffer carry
  • connect edges. a-b, b-c -> a-b-c

example output

building '/nix/store/rp6k0xaqmh0jqzfr0fw7g98vw01mwbdl-cyclic-outputs.drv'...
error: cycle detected. found 3 cycle edges:
1:
 - /nix/store/1x6r75x982h9kj1cfxva5w1086r37da0-cyclic-outputs-a/a-to-b
 - /nix/store/9c438fsszgkq24fi85iis3ksc1xanxz5-cyclic-outputs-b/b-to-c
 - /nix/store/a4mg9w51y7dcsrl0kykvmx24pzcv8czr-cyclic-outputs-c/c-to-a
 - /nix/store/1x6r75x982h9kj1cfxva5w1086r37da0-cyclic-outputs-a/a-to-b
2:
 - /nix/store/1x6r75x982h9kj1cfxva5w1086r37da0-cyclic-outputs-a/a-to-b.3
 - /nix/store/9c438fsszgkq24fi85iis3ksc1xanxz5-cyclic-outputs-b/b-to-c.3
3:
 - /nix/store/9c438fsszgkq24fi85iis3ksc1xanxz5-cyclic-outputs-b/b-to-a.2
 - /nix/store/1x6r75x982h9kj1cfxva5w1086r37da0-cyclic-outputs-a/a-to-c.2
 - /nix/store/a4mg9w51y7dcsrl0kykvmx24pzcv8czr-cyclic-outputs-c/c-to-b.2
 - /nix/store/9c438fsszgkq24fi85iis3ksc1xanxz5-cyclic-outputs-b/b-to-a.2
error: cycle detected in build of '/nix/store/rp6k0xaqmh0jqzfr0fw7g98vw01mwbdl-cyclic-outputs.drv' in the references of output 'a' from output 'b'

@SuperSandro2000
Copy link
Member

I just ran into this and wanted to remind the author to revive this

@stale stale bot removed the stale label Oct 6, 2023
@lovesegfault
Copy link
Member

Same here, I ran into this issue a while back, and had to build Nix with this PR to figure out what was going on.

@Dessix
Copy link

Dessix commented Oct 6, 2023

I'm hoping for this as well, thanks to the recent upheaval in the Nix Python ecosystem breaking Poetry2nix in a way which cannot be debugged without this changeset.

Notably, this changeset may also want to prevent or catch the apparent segmentation faults that such cycles can cause, as the unchecked stack overflows can seemingly produce multiple types of failure behaviours.

In my experience, inability to debug cycles has been the most impactful aspect on my experience with the Nix language, especially with almost every module system (including that of NixOS) suffering from them in one circumstance or another.

@Kranzes
Copy link
Member

Kranzes commented Jan 5, 2024

Just want to point out that the author of this PR is banned from the Nix community for quite a while now. I suggest one of you should open a new PR.

@zimbatm zimbatm closed this Mar 9, 2024
@milahu450
Copy link

milahu450 commented Feb 28, 2025

please someone fix this...
this is a basic feature of a build system

from what i recall the one thing missing was
the search for drv hashes across block boundaries
(buffer carry)
so this would also require some concatting of read buffers
no need to optimize for performance here
(second scan)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Cycle detected in the references of '/nix/store/...'" message could be more useful

7 participants