log: stderr offending large log messages#4930
Merged
algorandskiy merged 1 commit intoalgorand:masterfrom Dec 22, 2022
Merged
Conversation
cce
reviewed
Dec 21, 2022
Comment on lines
+132
to
+133
| buf := make([]byte, 16*1024) | ||
| stlen := runtime.Stack(buf, false) |
Contributor
There was a problem hiding this comment.
nit: debug.Stack() manages making a buffer for runtime.Stack() on your behalf, but 16K seems like it should be enough
10MB for min debug log line size is a lot!
Contributor
Author
There was a problem hiding this comment.
we get into this branch if exceeding cyclic.limit that is 1GB by default. and I only want to print really big messages even if someone sets smaller log file size for rotation.
Codecov Report
@@ Coverage Diff @@
## master #4930 +/- ##
==========================================
+ Coverage 53.48% 53.50% +0.01%
==========================================
Files 432 432
Lines 53616 53622 +6
==========================================
+ Hits 28678 28691 +13
+ Misses 22705 22701 -4
+ Partials 2233 2230 -3
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
cce
approved these changes
Dec 21, 2022
algobarb
pushed a commit
to algobarb/go-algorand
that referenced
this pull request
Dec 22, 2022
This was referenced Dec 22, 2022
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.
Summary
There is a possibility someone might log very large error messages, and they are lost if exceed the log rotation file size.
To prevent this, dump part of the message into stderr as well as callstack to see the caller.
Test Plan
Existing tests