-
Notifications
You must be signed in to change notification settings - Fork 26
fix: Add custom log reader implementation to fix hang on long log lines #263
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
Conversation
clients/destination.go
Outdated
| line, err := lr.NextLine() | ||
| if errors.Is(err, io.EOF) { | ||
| break | ||
| } else if err != nil { |
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.
can we somehow distinguish between line-to-long to some other errors where we actually want to exit.
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.
Thanks, should be handled better now 👍
|
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)? |
|
@yevgenypats I added some benchmarks: A tiny bit slower than BufferedScanner in this test (but we're talking nanoseconds here) and no additional allocs. |
🤖 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 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.