NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.15k stars 1.47k forks source link

nix search -u seems to have no upper bound on memory consumption #3306

Open hyphenrf opened 4 years ago

hyphenrf commented 4 years ago

So I tried to update the search cache after updating my channel to get the latest software in the search results, but when running nix search -u the memory consumption kept rising till eventually it was swapping beyond my 4GB ram and eventually bringing the laptop to a halt.

Is there a "proper" way to update the cache that I don't know of? Or is this just how things are?

If it's the former, then the tool itself doesn't make it clear (nix search --help etc..) and if it's the latter, then I expect a warning prompt at least, when running a command that might put my system to a halt.

I'm most likely not using the tool right if it ends up behaving like this, but if it is indeed an improper use why is it the most straightforward option?

hyphenrf commented 4 years ago

Some relevant info: I run nix in

hyphenrf commented 4 years ago

A hackish way I've found to alleviate this (a little) was to pipe the command to /dev/null, thus avoiding having to load the growing output in a pager.

SwissLaptop commented 4 years ago

same thing happens with

nix-env -i example at least since 19.03, probably earlier

BTW: SysRq+F doesn't work (thanks for disabling by default)

affected version: nixos 20.03.1445.95b9c99f6d0 (plasma5 live dvd)

steps to reproduce:

ulimit -m $[1024*1024] # in KiB nix search example [takes a while, CPU goes to 100%] < GC Warning: Out of memory - trying to allocate requested amount (336 bytes)... [repeated a lot] < GC Warning: Header allocation failed: dropping block < GC Warning: Failed to expand heap by 16777216 bytes < GC Warning: Failed to expand heap by 262144 bytes < GC Warning: Out of Memory! Heap size: 677 MiB. Returning NULL! < error: out of memory

i suggest using that as a test

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

stale[bot] commented 2 years ago

I closed this issue due to inactivity. → More info