nix-tree icon indicating copy to clipboard operation
nix-tree copied to clipboard

Reproducible hanging

Open viraptor opened this issue 3 years ago • 1 comments

I've run into a specific case where nix-tree will lock up. What I'm doing is:

  • run nix-shell -p nix-tree --run "nix-tree --derivation /nix/store/aq69wwnfqb5c62kk6vaafc3x9kj37cjp-newsboat-2.28-vendor.tar.gz.drv"
  • use / to search for headers
  • select the second linux-headers-5.18.drv entry
  • press w

The process becomes unresponsive. This is repeatable. I'm not sure what's specific about that dependency - others open the "why-depends" window without issues.

viraptor avatar Jun 28 '22 11:06 viraptor

Thank you for opening the issue, it was pretty interesting!

I had a look, and was able to reproduce the issue on the derivation you mentioned, and on a few others. I believe it is a memory leak/consumption issue that occurs when the why-depends output is too large. I can see that as soon as I press w it starts consuming more and more memory, and eventually gets killed.

I will try to figure out the cause, but it might simply be a matter of exponential explosion of potential paths. So maybe we need an upper limit.

(for reference, the code that calculates it is here: https://github.com/utdemir/nix-tree/blob/9098dc99cb975015a3ce0b99d8d5cb498eb98a2e/src/NixTree/PathStats.hs#L95-L111)

utdemir avatar Jun 29 '22 23:06 utdemir

Hey @viraptor , I believe I worked around the issue, or at least I can not reproduce it anymore. It's merged tomain, so feel free to check it out.

I'll probably cut a release in a couple of weeks.

Thanks again for the issue.

utdemir avatar Oct 24 '22 05:10 utdemir