Skip to content

change TSI socket max frame size to 16KB - #15297

Merged
antoniovicente merged 5 commits into
envoyproxy:mainfrom
yihuazhang:alts_max_frame_size
Mar 10, 2021
Merged

antoniovicente merged 5 commits into
envoyproxy:mainfrom
yihuazhang:alts_max_frame_size

Conversation

@yihuazhang

Copy link
Copy Markdown
Contributor

This PR resolves the first issue described in #15296.

Note that we need to set the maximum frame size (16KB) in the following two places:

  1. When creating an ALTS TSI handshaker
  2. When creating a zero-copy frame protector

The frame size set in 1. will be used in the frame size negotiation by telling its peer what is the desired frame size for the sender. The frame size set in 2. will be used to compare with the peer's frame size to determine the final frame size to use.
We need to ensure the same frame size is used in 1. and 2.

Notice that both API's used in 1. and 2. are gRPC TSI surface API's (alts_tsi_handshaker_create() and tsi_handshaker_result_create_zero_copy_grpc_protector()) so all we need to ensure is to pass the same frame size to those API's. After this PR is merged, I will prepare for a patch to update the max frame size used in the internal TSI handshaker.

@yihuazhang
yihuazhang requested a review from htuch as a code owner March 4, 2021 00:05
@repokitteh-read-only

Copy link
Copy Markdown

Hi @yihuazhang, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #15297 was opened by yihuazhang.

see: more, trace.

@yihuazhang

Copy link
Copy Markdown
Contributor Author

@antoniovicente F.Y.I.

@yihuazhang
yihuazhang force-pushed the alts_max_frame_size branch from 8d3e5b7 to 60fb222 Compare March 4, 2021 00:07
tsi_result status = alts_tsi_handshaker_create(
options.get(), target_name, handshaker_service.c_str(), is_upstream,
nullptr /* interested_parties */, &handshaker, 0 /* default max frame size */);
nullptr /* interested_parties */, &handshaker, 16384 /* default max frame size */);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for making these changes.

Would it be possible to add some basic tests to cover the behavior changes in this PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1 on tests. Thanks @yihuazhang for the quick PR!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It took some time figuring out how the current envoy/alts tests work. I added some tests to verify if a correct frame size (16KB) will be used by a protector. There are some tests that I want to add, which depend on the change in gRPC code base (grpc/grpc#25621). I added TODO for them, and will fix them once the PR is in and envoy updates the gRPC version.

@yihuazhang
yihuazhang force-pushed the alts_max_frame_size branch from 11f1da7 to 2a9c4d4 Compare March 4, 2021 21:22
tsi_zero_copy_grpc_protector* frame_protector;
grpc_core::ExecCtx exec_ctx;
status = tsi_handshaker_result_create_zero_copy_grpc_protector(handshaker_result, nullptr,
status = tsi_handshaker_result_create_zero_copy_grpc_protector(handshaker_result, &default_max_frame_size_,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@antoniovicente antoniovicente left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Change looks great, but needs a format fix.

@htuch

htuch commented Mar 5, 2021

Copy link
Copy Markdown
Member

@yihuazhang thanks for the fix! I had a quick look at the test and one thing I was wondering about is how much of the bug is fixed here before we do a TSI library update. Is this just changing the Envoy max frame size plumbing, but we need a TSI-side fix as well for it to be fully effective?

@yihuazhang
yihuazhang requested a review from asraa as a code owner March 5, 2021 17:46
Signed-off-by: yihuaz <[email protected]>
@yihuazhang
yihuazhang force-pushed the alts_max_frame_size branch from ccda647 to b5244bb Compare March 5, 2021 17:48
@yihuazhang

yihuazhang commented Mar 5, 2021 •

Copy link
Copy Markdown
Contributor Author

@htuch The changes in this PR does not need the TSI library change to become affective. The TSI library change is just for a more comprehensive testing for the changes in this PR. Once this PR is in, we should be able to resolve the first issue mentioned in #15296. Still have two more to go :)

Signed-off-by: yihuaz <[email protected]>

@htuch htuch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, will hand this over to @antoniovicente for final approval/merge as CODEOWNER.

@antoniovicente

Copy link
Copy Markdown
Contributor

/retest

multiarch is known to be flaky/broken.

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #15297 (comment) was created by @antoniovicente.

see: more, trace.

@antoniovicente

Copy link
Copy Markdown
Contributor

Can you merge upstream/main ?

I don't know what's up with the docker linux multiarch failure. Hopefully merging upstream/main will fix it.

/wait

@yihuazhang

Copy link
Copy Markdown
Contributor Author

It seems the same test still fails even after merging with upstream/main :(

@yihuazhang

Copy link
Copy Markdown
Contributor Author

@antoniovicente, so I guess we need to wait until #14971 is resolved to merge this PR?

@yihuazhang

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #15297 (comment) was created by @yihuazhang.

see: more, trace.

@antoniovicente

Copy link
Copy Markdown
Contributor

@antoniovicente, so I guess we need to wait until #14971 is resolved to merge this PR?

It may be possible for someone with superuser permissions like @htuch to force the merge. Let's see if the most recent retry succeeds.

@antoniovicente
antoniovicente merged commit 7d36ea5 into envoyproxy:main Mar 10, 2021
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