JSONLogger: rate-limit resProgress per activity - #16369
Open
Mic92 wants to merge 1 commit into
Open
Conversation
cole-h
reviewed
Aug 26, 2026
Mic92
force-pushed
the
jsonlogger-throttle-progress
branch
from
August 27, 2026 00:53
d0aca11 to
d2a633d
Compare
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
force-pushed
the
jsonlogger-throttle-progress
branch
from
August 27, 2026 00:54
d2a633d to
37daef7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.