Skip to content

Nix throws away crucial end of log when printed too fast #10289

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

Open
roberth opened this issue Mar 22, 2024 · 1 comment
Open

Nix throws away crucial end of log when printed too fast #10289

roberth opened this issue Mar 22, 2024 · 1 comment
Labels
bug derivation-build The process of building an individual derivation (see also sandbox label)

Comments

@roberth
Copy link
Member

roberth commented Mar 22, 2024

Describe the bug

If a derivation logs too fast before exiting, it is cut off. This removes the last lines, which tend to contain important information about the failure.

Steps To Reproduce

{ pkgs ? import <nixpkgs> {} }:

pkgs.runCommand "log-fast-die-young" { } ''
  for ((i=0; i<10000; i=i+1)) do
    echo "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa $i"
  done
  echo 'crucial info about the failure'
  exit 1
''

Expected behavior

When the builder exits, do something lenient but robust, like read another 128 KiB, and stop after 10 seconds.
If we hit one of the limits, add a line to the log to explain that the log is incomplete.

nix-env --version output

Additional context

I've talked about this problem before, but couldn't find an issue.
Keywords: Log truncation, derivation logging, rapid log output, truncated build logs, log cutoff issue, insufficient log capture, lost log data, build failure information loss, logging speed limitation, incomplete log output

Priorities

Add 👍 to issues you find important.

@roberth roberth added bug derivation-build The process of building an individual derivation (see also sandbox label) labels Mar 22, 2024
@roberth
Copy link
Member Author

roberth commented Nov 9, 2024

Possible workaround: avoid remote builder, --builders ""
This might increase the throughput, reducing the backpressure so that the logs can be read before the exit code is processed semi-independently. (hypothesis)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug derivation-build The process of building an individual derivation (see also sandbox label)
Projects
None yet
Development

No branches or pull requests

1 participant