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

txn: don't try to decode request bodies > raft.SuggestedMaxDataSize #6422

Merged
merged 3 commits into from
Aug 30, 2019

Conversation

s-mang
Copy link
Contributor

@s-mang s-mang commented Aug 29, 2019

This PR is a small, incremental step towards "fixing" #6147.

This change was originally suggested by @mkeeler in the issue description.

The basic premise of this change is that we are checking the request body size at the end of this fn (convertOps), after a huge request body may have already been decoded by mapstructure. The idea here is that we should try to check the request body size at the beginning of the fn as well, before sending it to mapstructure.

I'm submitting a PR here to suggest this change, but I am fully ready to scrap this code if it is not desirable. I will leave that decision to my reviewers.

@s-mang s-mang requested a review from a team August 29, 2019 18:23
@s-mang
Copy link
Contributor Author

s-mang commented Aug 29, 2019

open question: should this functionality only be for convertOps, and not universally applied to decodeBody? (cc @i0rek )

@mkeeler
Copy link
Member

mkeeler commented Aug 29, 2019

Its unfortunate but I don't think we can do this. Vault will send Txn or KV requests that can exceed that suggested size. Prior to 1.5.3 they couldn't but then we added the ability to enable raft chunking specifically so Vault could send larger requests.

@banks
Copy link
Member

banks commented Aug 30, 2019

@mkeeler I think you were right because the original commit here used raft. SuggestedMaxDataSize as the limit and we allow users to increase beyond that (undocumented) now. That said, I think the correct fix is to move to using the config. KVMaxValueSize which happened in the latest commit, but I'm not sure why the check needed to move to a more specific location? If we use config. KVMaxValueSize I think that should be appropriate for any endpoint unless I'm missing something?

@mkeeler
Copy link
Member

mkeeler commented Aug 30, 2019

@banks I think you are right in that we could use config.KVMaxValueSize instead of the raft suggested data size and that should allow this to work with our target use case for raft chunking. The odd part (that I missed during those original PRs) is that its not config.MaxTxnSize or something less tied to the KV because for non-Vault use cases whats coming in might have nothing to do with the KV but instead be a batch of node, service and check updates. Another interesting bit is that the Txn we are parsing might not do writes at all and thus might avoid raft all together. We should still place some upper bound on what we think the max content length prior to deserialization should be but I am not certain it should definitely be tied to the KVMaxValueSize.

@banks
Copy link
Member

banks commented Aug 30, 2019 via email

Copy link
Member

@mkeeler mkeeler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@s-mang s-mang changed the title don't try to decode request bodies > raft.SuggestedMaxDataSize txn: don't try to decode request bodies > raft.SuggestedMaxDataSize Aug 30, 2019
@s-mang s-mang merged commit 9f4b329 into master Aug 30, 2019
@s-mang s-mang deleted the txn-endpoint-performance branch September 5, 2019 19:20
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.

3 participants