-
Notifications
You must be signed in to change notification settings - Fork 107
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
Unenforced discard limits #620
Comments
Connect docs for
The current behaviour is not interchangeable to only being applied per message or per handler. |
This is for client and bidi stream endpoints, too? I thought that if the handler detected that this limit was exceeded that it results in a "resource exhausted" error to the client. That suggests that the RPC is immediately failed. But it sounds like what you're saying is that doesn't happen automatically -- it would require the handler to propagate the error that was returned from Seems like possibly a bug. Unclear what should happen on the client side though -- if it received a message that was too large and wanted to fail the RPC, the best it can do is to cancel, which really isn't the same. Also, "exhausting the response stream" typically means calling |
Sorry I was unclear. The Had not even thought about |
An internal discard limit is applied to limit discarding bytes from a connection on close. It's currently at 4MiB:
connect-go/protocol.go
Line 43 in 734ea94
However when connect receives a large message payload it discards the entire message to read the max size and report an error :
connect-go/envelope.go
Lines 253 to 257 in 734ea94
connect-go/protocol_connect.go
Lines 1087 to 1091 in 734ea94
This avoids the discard limit and will read up to the max message size (max uint32, and potentially more in connect unary?). This also can read much more than the
connect.WithReadMaxBytes
limited, although it won't keep the total payload in memory.To Reproduce
To showcase I wrote a quick test to time a large payload with a server that has a 2MiB limit. Each iteration takes around 4.5s locally. Altering the bounds to error and not discard reduce this to less than 1s (presumably the time to marshal and start sending the large payload).
Open questions
Additional Info
Opened #606 to explore a solution, but needs clarification on how discard limits should be calculated.
The text was updated successfully, but these errors were encountered: