Monkey-patch for Golang bufio.Scanner hardcoded maxTokenSize = 64 KB #25
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.
Hi! There's a problem that affects etcd: grpc-websocket-proxy doesn't handle server messages (i.e replies!) longer 64 KB.
Problem lies in Golang's bufio.Scanner that has a hard-coded maxTokenSize value equal to 64 KB.
Error message in this case is:
time="2020-10-18T15:42:56Z" level=warning msg="scanner err: bufio.Scanner: token too long"
In this pull request I submit a rather ugly fix for this problem. It overwrites a private field inside the bufio.Scanner.
I think it may be viable as a quick fix, but of course I'll appreciate if you'll fix it in some proper way. :-)
A simple test example that reproduces the bug in etcd is here: https://gist.github.com/vitalif/a634ac0543e6cacdda4ec288d922d9cf