Skip to content

nix-instantiate sends the same derivation to the server multiple times #14006

@KAction

Description

@KAction

Nix clients sends to the daemon the same thing again and again. Here is the simple reproducer, where bash release tarball and set of patches were sent to daemon five times. This is not exactly bug (it doesn't affect correctness), but it negatively affects evaluation speed.

$ git log -n1 --format=%H
49554fe37848835fc8ef915c13ca612a49e18744
$ nix --version
nix (Nix) 2.28.3
$ cat /etc/os-release
ANSI_COLOR="0;38;2;126;186;228"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
BUILD_ID="25.05pre-git"
CPE_NAME="cpe:/o:nixos:nixos:25.05"
DEFAULT_HOSTNAME=nixos
DOCUMENTATION_URL="https://nixos.org/learn.html"
HOME_URL="https://nixos.org/"
ID=nixos
ID_LIKE=""
IMAGE_ID=""
IMAGE_VERSION=""
LOGO="nix-snowflake"
NAME=NixOS
PRETTY_NAME="NixOS 25.05 (Warbler)"
SUPPORT_URL="https://nixos.org/community.html"
VARIANT=""
VARIANT_ID=""
VENDOR_NAME=NixOS
VENDOR_URL="https://nixos.org/"
VERSION="25.05 (Warbler)"
VERSION_CODENAME=warbler
VERSION_ID="25.05
$ strace -s100 -e write nix-instantiate . -A hello 2>&1|grep -F 'Derive([(\\"out\\"'|sort|uniq wc -l
131
$ strace -s100 -e write nix-instantiate . -A hello 2>&1|grep -F 'Derive([(\\"out\\"'|wc -l
183
$ strace -s100 -e write nix-instantiate . -A hello 2>&1|grep -F 'Derive([(\\"out\\"'|grep bash
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/0j41vs0ajmjn81i1mwhgvi24rr5hi4aa-bash53-001\",\"sha256\",\"1f60843436"..., 737) = 737
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/6iygjlcf64ryrg6jryk6qrjfxxz2i6q8-bash53-002\",\"sha256\",\"e385548a00"..., 737) = 737
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/bm2dknmrjbsd49idcliys6gyalnbd90i-bash53-003\",\"sha256\",\"f245d9c7dc"..., 737) = 737
write(3, "\301\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/kwm524zjlnnq4yfhhmb5r14f2wxf8a2j-bash-5.3.tar.gz\",\"sha256\",\"0d5cd"..., 721) = 721
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/0j41vs0ajmjn81i1mwhgvi24rr5hi4aa-bash53-001\",\"sha256\",\"1f60843436"..., 737) = 737
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/6iygjlcf64ryrg6jryk6qrjfxxz2i6q8-bash53-002\",\"sha256\",\"e385548a00"..., 737) = 737
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/bm2dknmrjbsd49idcliys6gyalnbd90i-bash53-003\",\"sha256\",\"f245d9c7dc"..., 737) = 737
write(3, "\301\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/kwm524zjlnnq4yfhhmb5r14f2wxf8a2j-bash-5.3.tar.gz\",\"sha256\",\"0d5cd"..., 721) = 721
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/0j41vs0ajmjn81i1mwhgvi24rr5hi4aa-bash53-001\",\"sha256\",\"1f60843436"..., 737) = 737
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/6iygjlcf64ryrg6jryk6qrjfxxz2i6q8-bash53-002\",\"sha256\",\"e385548a00"..., 737) = 737
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/bm2dknmrjbsd49idcliys6gyalnbd90i-bash53-003\",\"sha256\",\"f245d9c7dc"..., 737) = 737
write(3, "\301\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/kwm524zjlnnq4yfhhmb5r14f2wxf8a2j-bash-5.3.tar.gz\",\"sha256\",\"0d5cd"..., 721) = 721
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/0j41vs0ajmjn81i1mwhgvi24rr5hi4aa-bash53-001\",\"sha256\",\"1f60843436"..., 737) = 737
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/6iygjlcf64ryrg6jryk6qrjfxxz2i6q8-bash53-002\",\"sha256\",\"e385548a00"..., 737) = 737
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/bm2dknmrjbsd49idcliys6gyalnbd90i-bash53-003\",\"sha256\",\"f245d9c7dc"..., 737) = 737
write(3, "\301\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/kwm524zjlnnq4yfhhmb5r14f2wxf8a2j-bash-5.3.tar.gz\",\"sha256\",\"0d5cd"..., 721) = 721
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/0j41vs0ajmjn81i1mwhgvi24rr5hi4aa-bash53-001\",\"sha256\",\"1f60843436"..., 737) = 737
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/6iygjlcf64ryrg6jryk6qrjfxxz2i6q8-bash53-002\",\"sha256\",\"e385548a00"..., 737) = 737
write(3, "\321\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/bm2dknmrjbsd49idcliys6gyalnbd90i-bash53-003\",\"sha256\",\"f245d9c7dc"..., 737) = 737
write(3, "\301\2\0\0\0\0\0\0Derive([(\"out\",\"/nix/store/kwm524zjlnnq4yfhhmb5r14f2wxf8a2j-bash-5.3.tar.gz\",\"sha256\",\"0d5cd"..., 721) = 72

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions