Skip to content

JSONLogger: rate-limit resProgress per activity - #16369

Open
Mic92 wants to merge 1 commit into
NixOS:masterfrom
Mic92:jsonlogger-throttle-progress
Open

JSONLogger: rate-limit resProgress per activity#16369
Mic92 wants to merge 1 commit into
NixOS:masterfrom
Mic92:jsonlogger-throttle-progress

Conversation

@Mic92

@Mic92 Mic92 commented Aug 26, 2026

Copy link
Copy Markdown
Member

One of the issues I debugged live on a builder as it happened, so a bit hard to reproduce otherwise.

copyPaths() reports progress for every NAR chunk and JSONLogger wrote a line for each. In build-remote the log fd is a pipe that nix-daemon only drains between goal iterations, so the hook blocked in JSONLogger::write mid-NAR while holding the upload lock, stalling all remote builds to that machine.

This is fixed by emitting resProgress at most every 100ms per activity, except for the final update (done >= expected).

This commit just removes the trigger but we might want to fix the underlying issue later in a more principled way that removes the hook's log output back-pressure completely from the tryBuildHook logic, since the pipe theoretically still can get full.

However overall it seems reasonable to rate limit this event anyhow to reduce load on nix clients and this fix might be an easy backport.

@Mic92
Mic92 requested a review from edolstra as a code owner August 26, 2026 11:12
Comment thread src/libutil/logging.cc Outdated
@Mic92
Mic92 force-pushed the jsonlogger-throttle-progress branch from d0aca11 to d2a633d Compare August 27, 2026 00:53
copyPaths() reports progress for every NAR chunk and JSONLogger wrote a
line for each. In build-remote the log fd is a pipe that nix-daemon only
drains between goal iterations, so the hook blocked in
JSONLogger::write mid-NAR while holding the upload lock, stalling all
remote builds to that machine.

This is fixed by emitting resProgress at most every 100ms per activity,
except for the final update (done >= expected).

This commit just removes the trigger but we might want to fix the underlying
issue later in a more prinicipaled way that removes the hook's log output
completely from the tryBuildHook logic, since the pipe theoretically
still can get full.

However overall it seems reasonable to rate limit this event anyhow to
reduce load on nix clients and this fix might be an easy backport.
@Mic92
Mic92 force-pushed the jsonlogger-throttle-progress branch from d2a633d to 37daef7 Compare August 27, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants