Skip to content

quiche: quic client codec and setup integration test#8496

Merged
mattklein123 merged 89 commits intoenvoyproxy:masterfrom
danzh2010:quicintegration
Dec 5, 2019
Merged

quiche: quic client codec and setup integration test#8496
mattklein123 merged 89 commits intoenvoyproxy:masterfrom
danzh2010:quicintegration

Conversation

@danzh2010
Copy link
Copy Markdown
Contributor

@danzh2010 danzh2010 commented Oct 4, 2019

Implement EnvoyQuicClientStream|Session|Connection which are similar to server side code. EnvoyQuicClientConnection, as Network::ClientConnection, also dispatches IO events.

Use codec type HTTP3 and corresponding stats in QUIC codecs. Integrate QUIC server and client codec with HCM and ClientCodec via corresponding factory to avoid direct dependency on QUICHE code.

Risk Level: low, refactor to unused code
Testing: added quic_http_integration_test.cc and ConfigHelper::QUIC_HTTP_PROXY_CONFIG
Part of #2557

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/.

🐱

Caused by: #8496 was opened by danzh2010.

see: more, trace.

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>
@mattklein123 mattklein123 self-assigned this Oct 6, 2019
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
@alyssawilk alyssawilk self-assigned this Oct 7, 2019
Signed-off-by: Dan Zhang <danzh@google.com>
This reverts commit 3e39fbe.

Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
This reverts commit 95eb51d.

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

Going to put this one in waiting until we sort out the HTTP/3 PR. This is amazing though. :)

/wait

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
Copy Markdown
Contributor Author

Ping?

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

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Epic! Some small/random comments otherwise LGTM as something we can ship and iterate. @alyssawilk can you take another pass so we can get this merged and unblock @danzh2010? We have been very slow on reviews!

/wait


EnvoyQuicServerSession::~EnvoyQuicServerSession() {
ASSERT(!quic_connection_->connected());
QuicFilterManagerConnectionImpl::quic_connection_ = nullptr;
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.

nit: del (similar elsewhere)

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.

This is needed as explained in client session.

name: route_config_0
)EOF";

const std::string ConfigHelper::QUIC_HTTP_PROXY_CONFIG = BASE_UDP_LISTENER_CONFIG + R"EOF(
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.

I wonder if this should be a config helper vs. a full new config? I will defer to @alyssawilk on this one.

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.

I'd mildly prefer this to be a standard config modifier / helper, especially as eventually I'd like to run the H1/H2 tests with H1/H2/H3. Eventually I think we'll want to just apply the quic config modifiers when the client / upstream type is H3 and I think that'll be easier if we use standard config, so we don't get out of sync if someone tweaks the standard access loggers or some such.

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.

Okay, added a TODO to generalize an HttpProxyConfig for both TCP and QUIC

Copy link
Copy Markdown
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.

Yeah, I'm pretty much fine with this - I'm fine with any or all of my comments landing in a follow up just so we can get the big one merged.

if (connectionSocket()->ioHandle().isOpen()) {
file_event_ = dispatcher_.createFileEvent(
connectionSocket()->ioHandle().fd(),
[this](uint32_t events) -> void { onFileEvent(events); }, Event::FileTriggerType::Edge,
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.

Hand-waving here, we could have a periodic alarm which checked some runtime value (or check on packet ingress) which just disabled the listening socket. Again out of scope for this PR but I think it'd be good to be able to push via runtime and not just via LDS

// callback to do it in next loop. This is because unblocking QUIC
// stream can lead to immediate upstream encoding.
unblock_posted_ = true;
connection()->dispatcher().post([this] {
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.

Just checking, if something else happens in this event loop to change should_block, switchStreamBlockState will still be called. Do we handle that correctly?

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.

Yes, should_block_ will be updated in that case for switchStreamBlockState() to behave according to the latest value.

name: route_config_0
)EOF";

const std::string ConfigHelper::QUIC_HTTP_PROXY_CONFIG = BASE_UDP_LISTENER_CONFIG + R"EOF(
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.

I'd mildly prefer this to be a standard config modifier / helper, especially as eventually I'd like to run the H1/H2 tests with H1/H2/H3. Eventually I think we'll want to just apply the quic config modifiers when the client / upstream type is H3 and I think that'll be easier if we use standard config, so we don't get out of sync if someone tweaks the standard access loggers or some such.

Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
alyssawilk
alyssawilk previously approved these changes Dec 4, 2019
Copy link
Copy Markdown
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.

Again would like to see the integration test changes, but I'm happy with that being a follow-up

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

One small comment and then let's ship!

/wait

public:
const std::string Client = "client_codec";
const std::string Server = "server_codec";
const std::string Client = "quiche_client";
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.

We shouldn't let "quiche" leak into any core code. This should only be inside the extension itself, right? Can you move this into the extension directory or just remove this file entirely unless it needs to be referenced elsewhere?

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.

I think we don't want any core code depends on extension code. That's why I add them here. These are used to create quic codec in CodecHelper and integration test, we can't remove them.

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.

This is in the common directory. Just move this file into the extension directory then? There shouldn't be any reference to quiche in common code.

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.

Current this codec name is hard coded in codec_client and codec_config. It's possible to pass down from config for different QUIC implmentations, but currently there is no need. So I added a TODO for that at the call sites.

Meanwhile the names here should indicate that we are using QUICHE implementation, but no need to differentiate client and server. So I changed them to one var "Quiche".

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

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks!

codec_ = std::unique_ptr<ClientConnection>(
Config::Utility::getAndCheckFactory<Http::QuicHttpClientConnectionFactory>(
Http::QuicCodecNames::get().Client)
Http::QuicCodecNames::get().Quiche)
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.

nit: similar TODO here for config. Please add this in a follow up.

@mattklein123 mattklein123 merged commit 23724bc into envoyproxy:master Dec 5, 2019
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.

5 participants