-
Notifications
You must be signed in to change notification settings - Fork 4.1k
THRIFT-5862: Validate the message size at the endpoint transport only #3127
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
base: master
Are you sure you want to change the base?
Conversation
Would love to hear the reason for this. Really. |
Hi @Jens-G, mainly two reasons:
For a chain which has only TSocket, this configured limit doesn't take effect, and no clear way to mark the boundary of the message, i.e, assumption on |
@ all: Opinions? |
I still have problems with this one. Some layered transports do implement specific limits, the most prominent one is TFramedTransport. If we don't want to check that anymore, the whole point of the validation gets lost. Another example would be compression implemented as a layered transport. Endpoint raeds a 42 KB message which all of a sudden produces petabytes during decompression.
That's why we introduce artificial limits to validate against. If the limit is (just as an example) 10 MB then reading a message of 10 MB plus one byte should fail with the appropriate error message, no matter how much more data the socket would be able to deliver. This is by design. |
Thank you @Jens-G! Here is my understanding, please correct me if wrong.
This is a good case. TZlibTransport for example, it still checks the message limit after the de-compression. we still allow the user to implement their own message limit based on their needs, for example: thrift/lib/java/src/test/java/org/apache/thrift/protocol/ProtocolTestBase.java Lines 563 to 567 in 05b0659
An issue I can think of is how to distinguish different messages a socket might send, a Hive client can re-use the same socket for future uses, either for a different request or polling the request's status from the server. |
I was thinking about the frame size delivered with the message. That one is usually way lower than the allowed limit. That's what I meant by
|
Your example is broken. If someone passes in While I appreciate the efforts you put into this, I'm still not convinced (a) we should do this at all and (b) with the quality of the patch. If there are good arguments for a patch that let me believe in it and convince me that my doubts are unfounded, I am perfectly fine with it. But so far, you only managed to increased the latter. |
[skip ci]
anywhere in the commit message to free up build resources.