-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resolvedResult.builtOutputs
doesn't contain expected output after successful multi-output build
#6383
Comments
ok, when I rerun Nix, I hit this error every time...
it also happens when I run nix directly on the flake:
|
We should probably stop using |
This almost certainly comes from one of the uses of |
nix-2.5pre20211029_888771b and nix-2.6.0pre20220116_e1720b8 also show the same error (even when deleting the cache between each run), so it is either nix-daemon-, nix database, CA, or nixpkgs related, perhaps a combination of these is necessary. This pretty much means that although the error message appears on the client side, no recent client-side change could've caused this. But I also can't use a much older nix-daemon version, because the CA db schema changed in the last few months.
Interestingly, |
but that alone can't be the only reason, because with { pkgs ? import <nixpkgs> {
config.contentAddressedByDefault = true;
} }: {
file = pkgs.writeTextFile {
name = "nix-case-file";
text = ''
This is a test file.
'';
};
dir = derivation {
name = "nix-case-dir";
builder = "${pkgs.coreutils}/bin/mkdir";
args = [ "-p" "${placeholder "out"}" ];
system = builtins.currentSystem;
__contentAddressed = true;
};
} it works as expected: [zseri@orca:~/tmp/nixdbg2]$ nix-build -A dir ./default.nix
this derivation will be built:
/nix/store/zjyjr4xscbwilb1xnxg59wwrr319x00a-nix-case-dir.drv
resolved derivation: '/nix/store/zjyjr4xscbwilb1xnxg59wwrr319x00a-nix-case-dir.drv' -> '/nix/store/qzx327lgjk7kfw94hk1psz8hq9fqpqlb-nix-case-dir.drv'...
building '/nix/store/qzx327lgjk7kfw94hk1psz8hq9fqpqlb-nix-case-dir.drv'...
/nix/store/qrmj2g3mariwr2s9s09ar41dsvkqbqvf-nix-case-dir
[zseri@orca:~/tmp/nixdbg2]$ nix-build -A file ./default.nix
this derivation will be built:
/nix/store/9nziajzcm97pxz91j7i2z0qll0di6fps-nix-case-file.drv
resolved derivation: '/nix/store/9nziajzcm97pxz91j7i2z0qll0di6fps-nix-case-file.drv' -> '/nix/store/z0d40ll2k583gx3d9p1ii3agavg8h45b-nix-case-file.drv'...
building '/nix/store/z0d40ll2k583gx3d9p1ii3agavg8h45b-nix-case-file.drv'...
/nix/store/d5zb08hb13mqp74dkgm1x51nawfjadwv-nix-case-file adding a file or directory to the nix store also works:
|
interestingly, I previously had the error that some derivation in nixpkgs just produced no output, causing the derivation to fail...idk if that's related. |
To debug this further, I try to get rid of all interesting |
With #6393 applied I get the following error:
Mentioned derivation contents: ([('dev', '', 'r:sha256', ''), ('out', '', 'r:sha256', '')],
[],
['/nix/store/1kmkmwvs6d50z4jghnildm4cj3pzhvrq-gcc-wrapper-9.3.0',
'/nix/store/1yqclccnpawmjav9gp975n8pxcjh6n1s-perl-5.34.0',
'/nix/store/6bq5zqgfsn4m1p8fa6y6dfbvm9x2ip1r-gcc-wrapper-10.3.0',
'/nix/store/8n3dw45drrljrz52zanvlcfamwaj6n72-source',
'/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh',
'/nix/store/ffdzg3pbsl645k4a11ykasbvp858n6a5-which-2.21',
'/nix/store/hkid242kbc3mhyx7s4jpcsl0abdp5fnw-bash-5.1-p16',
'/nix/store/jiq6mmy3535a0859j0wmvvgl1r4s588r-stdenv-linux'],
'x86_64-linux',
'/nix/store/hkid242kbc3mhyx7s4jpcsl0abdp5fnw-bash-5.1-p16/bin/bash',
['-e', '/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh'],
[('NIX_HARDENING_ENABLE', 'fortify format'),
('blas64', ''),
('buildInputs', ''),
('builder',
'/nix/store/hkid242kbc3mhyx7s4jpcsl0abdp5fnw-bash-5.1-p16/bin/bash'),
('checkTarget', 'tests'),
('configureFlags', ''),
('depsBuildBuild',
'/nix/store/1kmkmwvs6d50z4jghnildm4cj3pzhvrq-gcc-wrapper-9.3.0 '
'/nix/store/6bq5zqgfsn4m1p8fa6y6dfbvm9x2ip1r-gcc-wrapper-10.3.0'),
('depsBuildBuildPropagated', ''),
('depsBuildTarget', ''),
('depsBuildTargetPropagated', ''),
('depsHostHost', ''),
('depsHostHostPropagated', ''),
('depsTargetTarget', ''),
('depsTargetTargetPropagated', ''),
('dev', '/02qcpld1y6xhs5gz9bchpxaw0xdhmsp5dv88lh25r2ss44kh8dxz'),
('doCheck', '1'),
('doInstallCheck', ''),
('hardeningDisable', 'stackprotector pic strictoverflow relro bindnow'),
('makeFlags',
'BINARY=64 CC=cc CROSS=0 DYNAMIC_ARCH=1 FC=gfortran HOSTCC=cc INTERFACE64=0 '
'NO_AVX512=1 NO_BINARY_MODE= NO_SHARED=0 NO_STATIC=1 NUM_THREADS=64 '
'PREFIX=/1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9 TARGET=ATHLON '
'USE_OPENMP=1'),
('name', 'openblas-0.3.20'),
('nativeBuildInputs',
'/nix/store/1yqclccnpawmjav9gp975n8pxcjh6n1s-perl-5.34.0 '
'/nix/store/ffdzg3pbsl645k4a11ykasbvp858n6a5-which-2.21'),
('out', '/1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9'),
('outputHashAlgo', 'sha256'),
('outputHashMode', 'recursive'),
('outputs', 'out dev'),
('patches', ''),
('pname', 'openblas'),
('postInstall',
' # Write pkgconfig aliases. Upstream report:\n'
' # https://github.com/xianyi/OpenBLAS/issues/1740\n'
' for alias in blas cblas lapack; do\n'
' cat <<EOF > $out/lib/pkgconfig/$alias.pc\n'
'Name: $alias\n'
'Version: 0.3.20\n'
'Description: $alias provided by the OpenBLAS package.\n'
'Cflags: -I$out/include\n'
'Libs: -L$out/lib -lopenblas\n'
'EOF\n'
' done\n'
'\n'
' # Setup symlinks for blas / lapack\n'
'ln -s $out/lib/libopenblas.so $out/lib/libblas.so\n'
'ln -s $out/lib/libopenblas.so $out/lib/libcblas.so\n'
'ln -s $out/lib/libopenblas.so $out/lib/liblapack.so\n'
'ln -s $out/lib/libopenblas.so $out/lib/liblapacke.so\n'
'ln -s $out/lib/libopenblas.so $out/lib/libblas.so.3\n'
'ln -s $out/lib/libopenblas.so $out/lib/libcblas.so.3\n'
'ln -s $out/lib/libopenblas.so $out/lib/liblapack.so.3\n'
'ln -s $out/lib/libopenblas.so $out/lib/liblapacke.so.3\n'),
('propagatedBuildInputs', ''),
('propagatedNativeBuildInputs', ''),
('src', '/nix/store/8n3dw45drrljrz52zanvlcfamwaj6n72-source'),
('stdenv', '/nix/store/jiq6mmy3535a0859j0wmvvgl1r4s588r-stdenv-linux'),
('strictDeps', ''),
('system', 'x86_64-linux'),
('version', '0.3.20')]) Present store paths: $ for i in /nix/store/*-openblas-0.3.20{,-dev}; do echo "$i"; done
/nix/store/3gah0acqfsh5a43cbq0w4y664w4xhpa3-openblas-0.3.20
/nix/store/9s9kr1qda57gbsxf881dx68zg230zyd3-openblas-0.3.20
/nix/store/a46kdvc7sd2da693cd7fn0v54d7ldp5i-openblas-0.3.20
/nix/store/b1kalaran9xarv5ng8nqqw5d22a5y6pm-openblas-0.3.20
/nix/store/g7fxzz27ljmrq9kcc5gyi2i50g3f6jw4-openblas-0.3.20
/nix/store/xzb471x2f9xrb13c84pzbbc8nmaz8gh5-openblas-0.3.20
/nix/store/3l4jql3dmashnfk0kwvch6jlwpn40yxi-openblas-0.3.20-dev
/nix/store/49c8nmr7fidsy6r4xnflq2639y87hyh0-openblas-0.3.20-dev
/nix/store/igjpzq7hf89cc5ivr9yrbs5zq3px1x12-openblas-0.3.20-dev
/nix/store/rdmkibibyxl0l0z23781j56r5cf2pni7-openblas-0.3.20-dev
/nix/store/v2958ri9qpfbnyka3h4lskpqi7h4p4hy-openblas-0.3.20-dev
/nix/store/vv9wy8kv45nxni6iz6w4lzf3sdbdj8iy-openblas-0.3.20-dev |
[root@orca:~]# for i in /nix/store/*-openblas-0.3.20*; do nix-store --delete "$i"; echo $?; done
finding garbage collector roots...
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/29jqw2h0q9d8xjl2qbwpln82qp1bxwjc-openblas-0.3.20.drv' since it is still alive. To find out why, use: nix-store --query --roots
1
finding garbage collector roots...
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/3gah0acqfsh5a43cbq0w4y664w4xhpa3-openblas-0.3.20' since it is still alive. To find out why, use: nix-store --query --roots
1
finding garbage collector roots...
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/3l4jql3dmashnfk0kwvch6jlwpn40yxi-openblas-0.3.20-dev' since it is still alive. To find out why, use: nix-store --query --roots
1
finding garbage collector roots...
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/4206c1fh1fk726146x2fzsz6sy35p5jd-openblas-0.3.20.drv' since it is still alive. To find out why, use: nix-store --query --roots
1
finding garbage collector roots...
deleting '/nix/store/49c8nmr7fidsy6r4xnflq2639y87hyh0-openblas-0.3.20-dev'
deleting unused links...
note: currently hard linking saves 155126.19 MiB
1 store paths deleted, 0.00 MiB freed
0
finding garbage collector roots...
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/vv9wy8kv45nxni6iz6w4lzf3sdbdj8iy-openblas-0.3.20-dev' since it is still alive. To find out why, use: nix-store --query --roots
1
finding garbage collector roots...
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/xhc03hrjzmhmasvi99w94sj6f9i4ri9n-openblas-0.3.20.drv' since it is still alive. To find out why, use: nix-store --query --roots
1
finding garbage collector roots...
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/xzb471x2f9xrb13c84pzbbc8nmaz8gh5-openblas-0.3.20' since it is still alive. To find out why, use: nix-store --query --roots
1
finding garbage collector roots...
0 store paths deleted, 0.00 MiB freed
error: Cannot delete path '/nix/store/yhzspk7x7d9w8axhqnnnspikjwp541ah-openblas-0.3.20.drv' since it is still alive. To find out why, use: nix-store --query --roots
1 doesn't help:
I'll try to run a garbage collection and check if that helps... |
next step would be debugging where the corruption happened... |
btw. |
Broader context: nix/src/libstore/build/derivation-goal.cc Lines 987 to 991 in 646af73
The following line produces the exception: nix/src/libstore/build/derivation-goal.cc Line 990 in 646af73
So, what happens here?
pre {last related change} blame: https://github.com/NixOS/nix/blame/28309352d991f50c9d8b54a5a0ee99995a1a5297/src/libstore/build/derivation-goal.cc |
This bug appears to affect many CA derivations with multiple outputs...
Sadly, I didn't start this compilation before adding further debugging to print the exact contents of the
|
map::at
errorresolvedResult.builtOutputs
doesn't contain expected output after successful multi-output build
Do you know if there is a workaround apart from restarting the build? I did a partial |
I don't know... I downgraded to 540d7e3 to be able to finish the nixos-rebuild. |
Oh, that's great! I confirm now I get slightly more precise errors:
|
you could try building nix against https://github.com/zseri/nix/tree/debug-6383, which should make this specific error more precise. (and might hint at the problem origin). (I currently don't want to test it myself because I'm in-between an update phase, and want to finish it first, which takes a few days) |
Aha, that reports failures like:
|
thanks. nix/src/libstore/build/local-derivation-goal.cc Lines 2651 to 2652 in 470e27c
|
related: #6312 cc @Ericson2314 you appear to have much more insight than me about how I suppose only commits after 540d7e3 are relevant (as in: might have caused this regression), but I'm not 100% sure about that. |
@zseri Yes we should land that. While I am not sure whether the race condition in fact happens, the larger point that we can clean up the code to be more robust certainly does. Also, removing the derived path from goals which, in any event, have mutable wanted outputs, is certainly a good a idea. |
When system-wide rebuilds happen for me I frequently see such failures. It looks like the pattern is multiple goal destructions for a single package:
Could it be that something underlying a package ( |
I am affected by that as well. Doing a system rebuild with |
Is this still happening after #7283 ? It's not sure, but there's a small chance that it's a different symptom of the same cause. |
I'd say it at least has got a lot better. I used to get quite a few failures while building |
And almost right after I posted it I got another transient failure:
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-40/23480/1 |
check the store for input before failing (hopefully fix #6383)
Describe the bug
Got the following error, but absolutely no information where exactly it occured (as-in no stacktrace or location info).
idk how to debug this.
Steps To Reproduce
Unknown.
Expected behavior
The error should either not happen, or at least contain enough information to know where to start debugging, or a stacktrace...
nix-env --version
outputnix-env (Nix) 2.8.0pre20220401_a24d077
but this might not be the version actually used, because this was hit when using
nixos-rebuild
, which first rebuilds itself.the other rev involved is 8b1e328.
Also happens with nix-env (Nix) 2.8.0pre20220307_92b8d4d.
nix-env (Nix) 2.7.0pre20220225_df552ff: unable to test against, because it hits a known SIGBUS before gettings near this bug.
Additional context
experimental-features = nix-command ca-derivations flakes
The text was updated successfully, but these errors were encountered: