-
Notifications
You must be signed in to change notification settings - Fork 381
fix(puller): prevent massive log lines from joined errors #5331
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
base: master
Are you sure you want to change the base?
Conversation
janos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach is maybe too high level. It looks to me that errors.Join is used in a way that is not ideal, maybe even misused. This is solving the problem with long log lines, but does not solve the root cause of using errors as lists of errors.
I would say that this is ok solution but ideally it would be better in the future to address the usage of errors.Join.
| @@ -0,0 +1,72 @@ | |||
| // Copyright 2025 The Swarm Authors. All rights reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2025 -> 2026
I agree. |
| errCount := countErrors(err) | ||
| if errCount > 1 { | ||
| p.logger.Debug("syncWorker interval failed", "error_count", errCount, "example_error", errors.Unwrap(err), "peer_address", address, "bin", bin, "cursor", cursor, "start", start, "topmost", top) | ||
| } else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errors.Unwrap() looks for Unwrap() error, but errors.Join() implements Unwrap() []error.
Would this return nil here?
Checklist
Description
Previously, when many errors were joined together during sync
operations, all errors were logged in a single line, creating
log entries up to 30KB (e.g., 245 identical "batch not found"
errors).
This commit adds countErrors() to count total errors and logs
only the count plus one example error, keeping entries concise
while maintaining diagnostic value.
Changes:
Example output:
Open API Spec Version Changes (if applicable)
Motivation and Context (Optional)
Related Issue (Optional)
Screenshots (if appropriate):