nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
6.55k stars 1.73k forks source link

bug: home-manager switch never completes due to infinite cc1plus processes #3877

Closed aaronpkelly closed 1 year ago

aaronpkelly commented 1 year ago

Are you following the right branch?

Is there an existing issue for this?

Issue description

My home-manager seems to be stuck in an infinite loop of trying to compile nodejs-18.15.0.drv

I normally just use home-manager switch and it works fine, but this is the first time home-manager has been stuck on something "for a long time".

So, for making this issue, I used home-manager switch --debug --print-build-logs --show-trace --verbose so that I could try and see where it's getting stuck, and here it is:

...
instantiated 'home-manager-generation' -> '/nix/store/j2m5m7gapypmp1n7khqzf0ap2fp5r608-home-manager-generation.drv'
these derivations will be built:
  /nix/store/gxr007lvkx23j75pdp94pr44ivgrwyy3-nodejs-18.15.0.drv
  /nix/store/6v70kxz2lxyc42hkl5dm9kr4jr44a4qk-chromium-unwrapped-112.0.5615.49.drv
  /nix/store/ijv16d9sg2kfhfadndcz5vv6m8zrwxab-asar-3.2.0.drv
  /nix/store/v122zc8jc8kmwvacqbi1q5v4pgxrhpg4-chromium-112.0.5615.49.drv
  /nix/store/zs9zhyyyhx5hkh79xmxsv242l417p14k-qtwebengine-6.4.3.drv
  /nix/store/l7mlyrdich8fayclb155yf3afiap9p2f-python3.10-PyQt6_WebEngine-6.4.0.drv
  /nix/store/v657dcxmbrw7bw938lgf7lfj5v35az33-calibre-6.15.1.drv
  /nix/store/rm39bqgl58byyx19nplsbdylpd8qgjvm-firefox-unwrapped-112.0.drv
  /nix/store/vlprm92k8jljk3gyyw3jx0g5h1ys5hjd-firefox-112.0.drv
  /nix/store/xqlx5lqm4nra6n3ryz26865x4lcfxnvs-vscodium-1.77.1.23095.drv
  /nix/store/xp8659q22x8g7fp03rvyyn5xcl452hsx-home-manager-path.drv
  /nix/store/k4ffqmhaaby8bq76lkimp4pslszqwhnd-activation-script.drv
  /nix/store/j2m5m7gapypmp1n7khqzf0ap2fp5r608-home-manager-generation.drv
setting up chroot environment in '/nix/store/gxr007lvkx23j75pdp94pr44ivgrwyy3-nodejs-18.15.0.drv.chroot'
executing builder '/nix/store/zlf0f88vj30sc7567b80l52d19pbdmy2-bash-5.2-p15/bin/bash'
using builder args '-e /nix/store/6xg259477c90a229xwmb53pdfkn6ig3g-default-builder.sh'
building '/nix/store/gxr007lvkx23j75pdp94pr44ivgrwyy3-nodejs-18.15.0.drv'...

At this point my fan whirs up... that's the way it stays for hours. The above process never finishes.

I used htop to find out what processes are being run in the background, and I can see that there are a number of cc1plus processes running over-and-over. They exist for about 10 seconds, and then new ones as created.

Here's an example of one:

cc1plus -quiet -I /nix/store/lf6arf2qj94qs6bkzfl2y75chb7awmx9-zlib-1.2.13-dev/include -I
 /nix/store/wcdi96dabywjdc03kr844plhk8mcsk5s-libuv-1.44.2/include -I
 /nix/store/8m54v44ggv77z9hc7y0jiyii6r99hw5a-openssl-3.0.8-dev/include -I
 /nix/store/4kzp60197xfqmnz6iqnwx5zk7w24qwk9-icu4c-72.1-dev/include -I ../src -I
 /build/node-v18.15.0/out/Release/obj/gen -I /build/node-v18.15.0/out/Release/obj/gen/include -I
 /build/node-v18.15.0/out/Release/obj/gen/src -I ../deps/base64/base64/include -I
 ../deps/googletest/include -I ../deps/histogram/src -I ../deps/uvwasi/include -I ../deps/simdutf -I
 ../deps/v8/include -I ../deps/llhttp/include -I ../deps/cares/include -I ../deps/nghttp2/lib/includes -I
 ../deps/brotli/c/include -isystem
 /nix/store/aafdki1nf49k5vxq6gx2yabiybk2bjmw-gcc-12.2.0/lib/gcc/x86_64-unknown-linux-gnu/12.2.0/include
 -isystem
 /nix/store/aafdki1nf49k5vxq6gx2yabiybk2bjmw-gcc-12.2.0/lib/gcc/x86_64-unknown-linux-gnu/12.2.0/include-fi
xed -MMD /build/node-v18.15.0/out/Release/obj.target/libnode/src/js_stream.d -MF
 /build/node-v18.15.0/out/Release/.deps//build/node-v18.15.0/out/Release/obj.target/libnode/src/js_stream.
o.d.raw -MQ /build/node-v18.15.0/out/Release/obj.target/libnode/src/js_stream.o -D_GNU_SOURCE -D_REENTRANT
 -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D V8_DEPRECATION_WARNINGS -D V8_IMMINENT_DEPRECATION_WARNINGS -D
 _GLIBCXX_USE_CXX11_ABI=1 -D NODE_OPENSSL_CONF_NAME=nodejs_conf -D ICU_NO_USER_DATA_OVERRIDE -D
 __STDC_FORMAT_MACROS -D NODE_ARCH="x64" -D NODE_PLATFORM="linux" -D NODE_WANT_INTERNALS=1 -D
 V8_DEPRECATION_WARNINGS=1 -D NODE_OPENSSL_SYSTEM_CERT_PATH="" -D NODE_USE_NODE_CODE_CACHE=1 -D
 HAVE_INSPECTOR=1 -D NODE_ENABLE_LARGE_CODE_PAGES=1 -D __POSIX__ -D NODE_USE_V8_PLATFORM=1 -D
 NODE_V8_SHARED_RO_HEAP -D NODE_HAVE_I18N_SUPPORT=1 -D HAVE_OPENSSL=1 -D BASE64_STATIC_DEFINE -D
 NGHTTP2_STATICLIB -idirafter /nix/store/wb2dlc8kpvrn960vq7j7c8822pi43n48-glibc-2.37-8-dev/include
 -idirafter
 /nix/store/aafdki1nf49k5vxq6gx2yabiybk2bjmw-gcc-12.2.0/lib/gcc/x86_64-unknown-linux-gnu/12.2.0/include-fi
xed -isystem /nix/store/8m54v44ggv77z9hc7y0jiyii6r99hw5a-openssl-3.0.8-dev/include -isystem
 /nix/store/wcdi96dabywjdc03kr844plhk8mcsk5s-libuv-1.44.2/include -isystem
 /nix/store/lf6arf2qj94qs6bkzfl2y75chb7awmx9-zlib-1.2.13-dev/include -isystem
 /nix/store/fdqpyj613dr0v1l1lrzqhzay7sk4xg87-python3-3.10.10/include -isystem
 /nix/store/9fqaqjjjvgk8fcy05319dhpgg7zwhvfx-http-parser-2.9.4/include -isystem
 /nix/store/4kzp60197xfqmnz6iqnwx5zk7w24qwk9-icu4c-72.1-dev/include -isystem
 /nix/store/8m54v44ggv77z9hc7y0jiyii6r99hw5a-openssl-3.0.8-dev/include -isystem
 /nix/store/wcdi96dabywjdc03kr844plhk8mcsk5s-libuv-1.44.2/include -isystem
 /nix/store/lf6arf2qj94qs6bkzfl2y75chb7awmx9-zlib-1.2.13-dev/include -isystem
 /nix/store/fdqpyj613dr0v1l1lrzqhzay7sk4xg87-python3-3.10.10/include -isystem
 /nix/store/9fqaqjjjvgk8fcy05319dhpgg7zwhvfx-http-parser-2.9.4/include -isystem
 /nix/store/4kzp60197xfqmnz6iqnwx5zk7w24qwk9-icu4c-72.1-dev/include -isystem
 /nix/store/8m54v44ggv77z9hc7y0jiyii6r99hw5a-openssl-3.0.8-dev/include -isystem
 /nix/store/wcdi96dabywjdc03kr844plhk8mcsk5s-libuv-1.44.2/include -isystem
 /nix/store/lf6arf2qj94qs6bkzfl2y75chb7awmx9-zlib-1.2.13-dev/include -isystem
 /nix/store/fdqpyj613dr0v1l1lrzqhzay7sk4xg87-python3-3.10.10/include -isystem
 /nix/store/9fqaqjjjvgk8fcy05319dhpgg7zwhvfx-http-parser-2.9.4/include -isystem
 /nix/store/4kzp60197xfqmnz6iqnwx5zk7w24qwk9-icu4c-72.1-dev/include -isystem
 /nix/store/8m54v44ggv77z9hc7y0jiyii6r99hw5a-openssl-3.0.8-dev/include -isystem
 /nix/store/wcdi96dabywjdc03kr844plhk8mcsk5s-libuv-1.44.2/include -isystem
 /nix/store/lf6arf2qj94qs6bkzfl2y75chb7awmx9-zlib-1.2.13-dev/include -isystem
 /nix/store/fdqpyj613dr0v1l1lrzqhzay7sk4xg87-python3-3.10.10/include -isystem
 /nix/store/9fqaqjjjvgk8fcy05319dhpgg7zwhvfx-http-parser-2.9.4/include -isystem
 /nix/store/4kzp60197xfqmnz6iqnwx5zk7w24qwk9-icu4c-72.1-dev/include -isystem
 /nix/store/8m54v44ggv77z9hc7y0jiyii6r99hw5a-openssl-3.0.8-dev/include -isystem
 /nix/store/wcdi96dabywjdc03kr

This will continue for hours, the same cc1plus process attempting to build what looks like the same file over and over.

Any idea how I can get past this?

Maintainer CC

No response

System information

❯ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.23, NixOS, 23.05 (Stoat), 23.05pre474054.85b081528b9`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.16`
 - channels(root): `"nixos-23.05pre474054.85b081528b9, nixos-hardware"`
 - channels(aaron): `"home-manager, nixos-23.05pre474090.29176972b4b, nixos-hardware"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
ncfavier commented 1 year ago

It just looks like Nix is rebuilding nodejs, which would definitely take some time and make some noise. Hard to say why it's not just substituting it from the binary cache without seeing your config.

aaronpkelly commented 1 year ago

Yeah I don't know why nodejs is not using the binary cache

Even when trying to just start a shell with nodejs, it still attempts to build it:

$ nix-shell -p nodejs
these derivations will be built:
  /nix/store/gxr007lvkx23j75pdp94pr44ivgrwyy3-nodejs-18.15.0.drv

I think this may be a general nix problem and not a home-manager problem, so I'll open a ticket over there

ncfavier commented 1 year ago

Do you maybe have an overlay in your nixpkgs config that could be causing the rebuild?

I would suggest cloning nixpkgs, checking out the revision you're supposed to be on (85b081528b9), running nix-instantiate -A nodejs and then comparing the two .drv files using nix-diff to see what's different.