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

quiche: use max header size configured in HCM #15912

Merged
merged 66 commits into from
Apr 29, 2021

Conversation

danzh2010
Copy link
Contributor

@danzh2010 danzh2010 commented Apr 10, 2021

Commit Message: use max header size in HCM config to initialize quic session.
Additional Description:
change QuicSession::Initialize() and filter chain creation order to set max header list size for each session before Initialize(). Move Initialize() of Http3 connection from CodecClient to CodecClientProd.
Added CodecClient::connect() interface.
Change EnvoyQuicConnection not to directly inherit from QuicConnection. And renamed it.
Fix a use-after-free bug in FakeUpstream which causes ASAN failure.

Risk Level: low
Testing: more protocol H3 tests

Part of #2557 #12930 #14829

Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
@danzh2010
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

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

🐱

Caused by: a #15912 (comment) was created by @danzh2010.

see: more, trace.

@alyssawilk
Copy link
Contributor

@snowp want me to take this one back?

@snowp
Copy link
Contributor

snowp commented Apr 26, 2021

@alyssawilk Sure, go for it :)

Signed-off-by: Dan Zhang <danzh@google.com>
Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Cool, looking good.
I do think we should up the risk level to medium given the client connect() change.

source/common/http/codec_client.cc Show resolved Hide resolved
@@ -5,11 +5,14 @@
#include "envoy/event/dispatcher.h"
#include "envoy/network/connection.h"

#define QUICHE_INCLUDE_1 "quiche/quic/core/quic_connection.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this all about? Can we have macro comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to avoid having duplicated #pragma GCC diagnostic... block in files includes QUICHE files. The block is moved to source/common/quic/quic_includes_ignores.h which only needs to be included at the end of the #include section. #define QUICHE_INCLUDE_1/2/...N is used in place of #include before each QUICHE header files.

Commented about its usage.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a plan to get rid of these? cc @DavidSchinazi yak shaver extrordinare

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the goal of this macro? What's wrong with having duplicated pragmas?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we have a plan to get rid of these? cc @DavidSchinazi yak shaver extrordinare

AFAIK, -Winvalid-offsetof will persist because it is caused by a QUIC frame memory optimization.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's the goal of this macro? What's wrong with having duplicated pragmas?

These pragmas are repeated in many files. And adding/removing a compiler option requires changing all the places. The goal of quic_includes_ignores.h is to avoid the duplication to improve both readability and maintainability. Though the macros are written in a very native way due to my limited preprocessor skill.

Copy link
Contributor

@antoniovicente antoniovicente Apr 26, 2021

Choose a reason for hiding this comment

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

2 things:

  • QUICHE_INCLUDE_1 is the only one of these that is used. We probably don't need 2 to 5
  • The header include that needs the pragma seems to be only quiche/quic/core/quic_connection.h; can we add a wrapper header with appropriate pragmas and have that include be the one that is included through the rest of Envoy code? Or have these pragmas added to quiche/quic/core/quic_connection.h via a quiche patch that Envoy adds while fetching the quiche dependency via bazel?

The best course of action would be to fix QUICHE. Until then, I guess duplicate pragmas are fine.

Copy link
Contributor Author

@danzh2010 danzh2010 Apr 27, 2021

Choose a reason for hiding this comment

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

  • QUICHE_INCLUDE_1 is the only one of these that is used. We probably don't need 2 to 5

The plan is to use QUICHE_INCLUDE_X in other files as well, they includes more QUICHE files which also needs the pragma diagnose ignore.

  • The header include that needs the pragma seems to be only quiche/quic/core/quic_connection.h; can we add a wrapper header with appropriate pragmas and have that include be the one that is included through the rest of Envoy code? Or have these pragmas added to quiche/quic/core/quic_connection.h via a quiche patch that Envoy adds while fetching the quiche dependency via bazel?

quic_connection.h is not the only one that needs the pragma, but most of them.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see what you're trying to do. I'd say just use the pragmas directly in places that need them for now (and remove quic_includes_ignores.h), and I can take an action item to fix QUICHE. The correct fix here is to make QUICHE build without warnings, not to disable them in Envoy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SG.

Signed-off-by: Dan Zhang <danzh@google.com>
Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Sorry looks like this needs a main merge as well?

@@ -5,11 +5,14 @@
#include "envoy/event/dispatcher.h"
#include "envoy/network/connection.h"

#define QUICHE_INCLUDE_1 "quiche/quic/core/quic_connection.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a plan to get rid of these? cc @DavidSchinazi yak shaver extrordinare

Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
@danzh2010
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Check envoy-presubmit isn't fully completed, but will still attempt retrying.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #15912 (comment) was created by @danzh2010.

see: more, trace.

Signed-off-by: Dan Zhang <danzh@google.com>
Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Looks great - almost there!

// Already detached from quic connection.
return;
}
if (!initialized_) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get here? I thought quicConnection would return null above if not initialized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! We need to distinguish between already closed and not initialized. In latter case, we need to retain close type and close in OnCanWrite().

Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

LGTM, assuming we're going to debug the re-excluded tests in follow-ups :-)

@alyssawilk alyssawilk merged commit 26a60c2 into envoyproxy:main Apr 29, 2021
gokulnair pushed a commit to gokulnair/envoy that referenced this pull request May 6, 2021
Commit Message: use max header size in HCM config to initialize quic session.
Additional Description:
change QuicSession::Initialize() and filter chain creation order to set max header list size for each session before Initialize(). Move Initialize() of Http3 connection from CodecClient to CodecClientProd.
Added CodecClient::connect() interface.
Change EnvoyQuicConnection not to directly inherit from QuicConnection. And renamed it.
Fix a use-after-free bug in FakeUpstream which causes ASAN failure.

Risk Level: low
Testing: more protocol H3 tests

Part of envoyproxy#2557 envoyproxy#12930 envoyproxy#14829

Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Gokul Nair <gnair@twitter.com>
gokulnair pushed a commit to gokulnair/envoy that referenced this pull request May 6, 2021
Commit Message: use max header size in HCM config to initialize quic session.
Additional Description:
change QuicSession::Initialize() and filter chain creation order to set max header list size for each session before Initialize(). Move Initialize() of Http3 connection from CodecClient to CodecClientProd.
Added CodecClient::connect() interface.
Change EnvoyQuicConnection not to directly inherit from QuicConnection. And renamed it.
Fix a use-after-free bug in FakeUpstream which causes ASAN failure.

Risk Level: low
Testing: more protocol H3 tests

Part of envoyproxy#2557 envoyproxy#12930 envoyproxy#14829

Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Gokul Nair <gnair@twitter.com>
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.

9 participants