darwin build failure on drvs with many dependencies #752

Closed
opened 2025-03-20 21:52:13 +00:00 by lheckemann · 3 comments
Member

Describe the bug

If a drv has too many dependencies (initially observed with a source-combining drv generated by uv2nix), builds will fail on darwin:

linus@windows7:~/ > nix-build test.nix --arg n 1500   
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
this derivation will be built:
  /nix/store/2ds4z7livj0c57sc5155vhx88ba9zl71-dependent.drv
error:
       … while waiting for the build environment for '/nix/store/2ds4z7livj0c57sc5155vhx88ba9zl71-dependent.drv' to initialize (failed with exit code 1, previous messages: sandbox initialization failed: data object length 65730 exceeds maximum (65535)|failed to configure sandbox)

       error: unexpected EOF reading a line

The error behaviour is a bit different with even more dependencies:

linus@windows7:~/ > nix-build test.nix --arg n 3000
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
this derivation will be built:
  /nix/store/lw3r2rbl4mb45l27y2ij9dcp5p5vlcw9-dependent.drv
error:
       … while waiting for the build environment for '/nix/store/lw3r2rbl4mb45l27y2ij9dcp5p5vlcw9-dependent.drv' to initialize (failed due to signal 10 (Bus error: 10), previous messages: )

       error: unexpected EOF reading a line

linus@windows7:~/ > nix-build test.nix --arg n 10000  
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
this derivation will be built:
  /nix/store/rqv7x889brx7lzhhqm9vrrz8mphhkilx-dependent.drv
error:
       … while waiting for the build environment for '/nix/store/rqv7x889brx7lzhhqm9vrrz8mphhkilx-dependent.drv' to initialize (failed with exit code 1, previous messages: failed to configure sandbox)

       error: unexpected EOF reading a line

Steps To Reproduce

Try building the following on darwin:

{ n ? 1500 }:
with import <nixpkgs> {};
let
  deps = lib.map (n: stdenv.mkDerivation { name = toString n; buildCommand = "touch $out"; }) (lib.range 0 n);
in stdenv.mkDerivation {
  name = "dependent";
  inherit deps;
  buildCommand = ''
    echo ok
  '';
}

Expected behavior

Build fails because the builder doesn't produce the output path.

nix --version output

nix (Lix, like Nix) 2.93.0-dev-pre20250307-93c3ca4
System type: aarch64-darwin
Additional system types: x86_64-darwin
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /Users/linus/.config/nix/nix.conf:/Users/linus/.nix-profile/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/7il9f02j582zxi6i16x2v0zvrajvnp1a-lix-2.93.0-dev-pre20250307-93c3ca4/share

## Describe the bug If a drv has too many dependencies (initially observed with a source-combining drv generated by uv2nix), builds will fail on darwin: ``` linus@windows7:~/ > nix-build test.nix --arg n 1500 warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring this derivation will be built: /nix/store/2ds4z7livj0c57sc5155vhx88ba9zl71-dependent.drv error: … while waiting for the build environment for '/nix/store/2ds4z7livj0c57sc5155vhx88ba9zl71-dependent.drv' to initialize (failed with exit code 1, previous messages: sandbox initialization failed: data object length 65730 exceeds maximum (65535)|failed to configure sandbox) error: unexpected EOF reading a line ``` The error behaviour is a bit different with even more dependencies: ``` linus@windows7:~/ > nix-build test.nix --arg n 3000 warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring this derivation will be built: /nix/store/lw3r2rbl4mb45l27y2ij9dcp5p5vlcw9-dependent.drv error: … while waiting for the build environment for '/nix/store/lw3r2rbl4mb45l27y2ij9dcp5p5vlcw9-dependent.drv' to initialize (failed due to signal 10 (Bus error: 10), previous messages: ) error: unexpected EOF reading a line linus@windows7:~/ > nix-build test.nix --arg n 10000 warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring this derivation will be built: /nix/store/rqv7x889brx7lzhhqm9vrrz8mphhkilx-dependent.drv error: … while waiting for the build environment for '/nix/store/rqv7x889brx7lzhhqm9vrrz8mphhkilx-dependent.drv' to initialize (failed with exit code 1, previous messages: failed to configure sandbox) error: unexpected EOF reading a line ``` ## Steps To Reproduce Try building the following on darwin: ``` { n ? 1500 }: with import <nixpkgs> {}; let deps = lib.map (n: stdenv.mkDerivation { name = toString n; buildCommand = "touch $out"; }) (lib.range 0 n); in stdenv.mkDerivation { name = "dependent"; inherit deps; buildCommand = '' echo ok ''; } ``` ## Expected behavior Build fails because the builder doesn't produce the output path. ## `nix --version` output nix (Lix, like Nix) 2.93.0-dev-pre20250307-93c3ca4 System type: aarch64-darwin Additional system types: x86_64-darwin Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /Users/linus/.config/nix/nix.conf:/Users/linus/.nix-profile/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/7il9f02j582zxi6i16x2v0zvrajvnp1a-lix-2.93.0-dev-pre20250307-93c3ca4/share
Owner

cf cl/2861

cf cl/2861
Author
Member

What fantastic timing!

What fantastic timing!
Member

This issue was mentioned on Gerrit on the following CLs:

  • comment in cl/2861 ("fix: split macos sandbox profile to avoid size errors")
  • commit message in cl/2861 ("fix: split macos sandbox profile to avoid size errors")
  • commit message in cl/2870 ("darwin: add regression test for sandbox fixes")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/2861", "number": 2861, "kind": "comment"}, {"backlink": "https://gerrit.lix.systems/c/lix/+/2861", "number": 2861, "kind": "commit message"}, {"backlink": "https://gerrit.lix.systems/c/lix/+/2870", "number": 2870, "kind": "commit message"}], "cl_meta": {"2861": {"change_title": "fix: split macos sandbox profile to avoid size errors"}, "2870": {"change_title": "darwin: add regression test for sandbox fixes"}}} --> This issue was mentioned on Gerrit on the following CLs: * comment in [cl/2861](https://gerrit.lix.systems/c/lix/+/2861) ("fix: split macos sandbox profile to avoid size errors") * commit message in [cl/2861](https://gerrit.lix.systems/c/lix/+/2861) ("fix: split macos sandbox profile to avoid size errors") * commit message in [cl/2870](https://gerrit.lix.systems/c/lix/+/2870) ("darwin: add regression test for sandbox fixes")
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#752
No description provided.