fix: Add custom log reader implementation to fix hang on long log lines#263
Merged
kodiakhq[bot] merged 5 commits intomainfrom Oct 9, 2022
Merged
fix: Add custom log reader implementation to fix hang on long log lines#263kodiakhq[bot] merged 5 commits intomainfrom
kodiakhq[bot] merged 5 commits intomainfrom
Conversation
yevgenypats
reviewed
Oct 7, 2022
clients/destination.go
Outdated
| line, err := lr.NextLine() | ||
| if errors.Is(err, io.EOF) { | ||
| break | ||
| } else if err != nil { |
Contributor
There was a problem hiding this comment.
can we somehow distinguish between line-to-long to some other errors where we actually want to exit.
Contributor
Author
There was a problem hiding this comment.
Thanks, should be handled better now 👍
Contributor
|
Is it possible to do some benchmarks vs the regular scanner just to see that we are not eating cpu/memory in comparison to the built-in scanner (given it can be quite intensive)? |
Contributor
Author
|
@yevgenypats I added some benchmarks: A tiny bit slower than BufferedScanner in this test (but we're talking nanoseconds here) and no additional allocs. |
disq
approved these changes
Oct 7, 2022
yevgenypats
approved these changes
Oct 9, 2022
shimonp21
pushed a commit
that referenced
this pull request
Oct 10, 2022
🤖 I have created a release *beep* *boop* --- ## [0.13.0](v0.12.10...v0.13.0) (2022-10-10) ### ⚠ BREAKING CHANGES * Support table_concurrency and resource_concurrency (#268) ### Features * Support table_concurrency and resource_concurrency ([#268](#268)) ([7717d6f](7717d6f)) ### Bug Fixes * Add custom log reader implementation to fix hang on long log lines ([#263](#263)) ([f8ca238](f8ca238)) * DeleteStale feature ([#269](#269)) ([837c5f3](837c5f3)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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.
This fixes an issue where the CLI would hang indefinitely when it encountered a log line from a plugin that was longer than the buffer size allowed for by
bufio.Scanner. The fix uses a wrapper aroundbufio.NewReaderto skip lines that are too long to be parsed, printing an error in the log with the first 1000 characters to help with identification.