Skip to content
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

Monkey-patch for Golang bufio.Scanner hardcoded maxTokenSize = 64 KB #25

Closed
wants to merge 1 commit into from

Conversation

vitalif
Copy link

@vitalif vitalif commented Oct 18, 2020

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

@vitalif
Copy link
Author

vitalif commented Oct 19, 2020

Oops sorry, it seems the newest version already supports changing maximum buffer size, I only need to patch etcd itself

@vitalif vitalif closed this Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant