Hi Joe,
Buffering happens in lower level (transport layer) and shouldn't be able to modify the message size.
There are two places where the error you mentioned could happen, and both in rpc_util.go. The first place (in func recvMsg()) is before we apply decoding, where we compare the encoded message length to the limit. The second place (in func recv()) is after we decode the message, where we compare the decoded (decompressed if compression was enabled) message length to the limit. It could be possible that your encoded message is within 4MB (you said no more than 4k in length), but the decoded message is much larger and beyond the limit.
What you can probably do is:
on client side, verify where does the error get generated, before the decoding or after the decoding.
on server side, print out the message size before and after encoding, and see if it's larger than 4MB.
Please let me know if it doesn't help and we can investigate more. And in that case, it would be great if you can provide us with a reproducible example.Thanks!
Yuxuan