Skip to content

Import current snapshot of QUICHE as an external dependency.#5548

Merged
htuch merged 15 commits intoenvoyproxy:masterfrom
mpwarres:import_quiche
Jan 18, 2019
Merged

Import current snapshot of QUICHE as an external dependency.#5548
htuch merged 15 commits intoenvoyproxy:masterfrom
mpwarres:import_quiche

Conversation

@mpwarres
Copy link
Contributor

@mpwarres mpwarres commented Jan 9, 2019

Description:

QUICHE is Google's implementation of
QUIC and related protocols. It is the same code used in Chromium and Google's
servers, but packaged in a form that is intended to be easier to incorporate
into third-party projects.

QUICHE is still a work in progress, with current efforts focusing on
eliminating diffs between Google-internal and Chromium variants of the code, as
well as providing buildfiles and a default implementation of the QUICHE
platform API (the platform-dependent porting layer that sits underneath the
main body of QUICHE, which is platform-independent).

In the interim, the Google QUIC team has created a branch of QUICHE,
envoy-integration,
to provide access to the full set of QUICHE source files, while the work above
continues. Since Envoy can overlay its own build rules on top of external
dependencies, this should allow Envoy/QUICHE integration work to move forwards,
without being blocked by completion of "full" QUICHE. When QUICHE is fully
complete, we can just update the dependency to point to the official QUICHE
release, making whatever buildfile adjustments are necessary.

This PR is limited to setting up a basic import of QUICHE with a bare skeleton
of build rules to build and test one element of the platform API. The plan is
to add more build rules and platform implementation classes incrementally, in a
series of follow-on CLs. The end milestone of the platform implementation phase
will be when we can run the QUIC end-to-end tests included in QUICHE on top of
the Envoy platform implementation.

Signed-off-by: Michael Warres mpw@google.com

For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md

Risk Level: low--code not used yet
Testing: unit test to exercise build rules
Docs Changes: none
Release Notes: none
[Optional Fixes #Issue]
[Optional Deprecated:]

QUICHE (https://quiche.googlesource.com/quiche/) is Google's implementation of
QUIC and related protocols. It is the same code used in Chromium and Google's
servers, but packaged in a form that is intended to be easier to incorporate
into third-party projects.

QUICHE is still a work in progress, with current efforts focusing on
eliminating diffs between Google-internal and Chromium variants of the code, as
well as providing buildfiles and a default implementation of the QUICHE
platform API (the platform-dependent porting layer that sits underneath the
main body of QUICHE, which is platform-independent).

In the interim, the Google QUIC team has created a branch of QUICHE,
envoy-integration (https://quiche.googlesource.com/quiche/+/envoy-integration),
to provide access to the full set of QUICHE source files, while the work above
continues. Since Envoy can overlay its own build rules on top of external
dependencies, this should allow Envoy/QUICHE integration work to move forwards,
without being blocked by completion of "full" QUICHE. When QUICHE is fully
complete, we can just update the dependency to point to the official QUICHE
release, making whatever buildfile adjustments are necessary.

This PR is limited to setting up a basic import of QUICHE with a bare skeleton
of build rules to build and test one element of the platform API. The plan is
to add more build rules and platform implementation classes incrementally, in a
series of follow-on CLs. The end milestone of the platform implementation phase
will be when we can run the QUIC end-to-end tests included in QUICHE on top of
the Envoy platform implementation.

Signed-off-by: Michael Warres <mpw@google.com>
@mpwarres
Copy link
Contributor Author

mpwarres commented Jan 9, 2019

@alyssawilk
Copy link
Contributor

I think on this one I'd like @htuch to take a pass since it's mostly bazel hackery and I want to make sure all QUIC code is easy to compile out.
Also you'll want to check the builds - looks like format and clang_tidy need a pass.

@alyssawilk
Copy link
Contributor

Also builds or not, this PR is super exciting. Hurrah for QUIC integration!

@htuch htuch self-assigned this Jan 9, 2019
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Awesome to do see this happening! I have some comment on repo structure, happy to chat IRL as well.

Signed-off-by: Michael Warres <mpw@google.com>
@htuch
Copy link
Member

htuch commented Jan 11, 2019

@mpwarres as discussed IRL, what you have here looks pragmatic. Can you add the TODOs and fix the CI build?

Signed-off-by: Michael Warres <mpw@google.com>
Signed-off-by: Michael Warres <mpw@google.com>
Signed-off-by: Michael Warres <mpw@google.com>
Signed-off-by: Michael Warres <mpw@google.com>
For the impl files that are trivially implemented, add the implementation.
For the impl files that require more work, add TODO comments.

Signed-off-by: Michael Warres <mpw@google.com>
@mpwarres
Copy link
Contributor Author

mpwarres commented Jan 14, 2019

Update: was almost ready to send this back out for review, but now I've hit a snag in the form of linker errors, that might indicate a problem with this approach for importing. I've pushed my latest commits even though they will cause pre-integration checks to fail, to help provide concrete illustration of the issue.

Details: after resolving other CI issues, I figured I might as well fill in some of the more trivial platform impl definitions. In doing so, I discovered that when the newly-added QUICHE platform impl classes in //source/extensions/quic_listeners/quiche/platform attempt to depend on Envoy classes, it causes linker errors, since (IIUC) the build target chain of "@com_googlesource_quiche//:http2_platform" -> "@envoy//source/extensions/quic_listeners/quiche/platform:http2_platform_impl_lib" -> "//source/common/common:assert_lib" generates .o files for various Envoy source files under bazel-out/k8-fastbuild/bin/external/envoy/source/, while the same Envoy classes compiled through normal build target chains (which do not got through "@com_googlesource_quiche//:http2_platform") end up in bazel-out/k8-fastbuild/bin/source/. Then, when the linker tries to link all .o files, it sees multiple definitions.

For example:

$ bazel build //test/extensions/quic_listeners/...
[...]
/usr/bin/ld.gold: error: bazel-out/k8-fastbuild/bin/source/common/common/_objs/assert_lib/assert.pic.o: multiple definition of 'Envoy::Assert::ActionRegistrationImpl::debug_assertion_failure_record_action_'
/usr/bin/ld.gold: bazel-out/k8-fastbuild/bin/external/envoy/source/common/common/_objs/assert_lib/assert.pic.o: previous definition here
/usr/bin/ld.gold: error: bazel-out/k8-fastbuild/bin/source/common/common/_objs/assert_lib/assert.pic.o: multiple definition of 'Envoy::Assert::setDebugAssertionFailureRecordAction(std::function<void ()>)'
/usr/bin/ld.gold: bazel-out/k8-fastbuild/bin/external/envoy/source/common/common/_objs/assert_lib/assert.pic.o: previous definition here
/usr/bin/ld.gold: error: bazel-out/k8-fastbuild/bin/source/common/common/_objs/assert_lib/assert.pic.o: multiple definition of 'Envoy::Assert::invokeDebugAssertionFailureRecordAction_ForAssertMacroUseOnly()'
/usr/bin/ld.gold: bazel-out/k8-fastbuild/bin/external/envoy/source/common/common/_objs/assert_lib/assert.pic.o: previous definition here
[...]

This (unfortunately) kind of makes sense, given the funky way in which Envoy is depending on QUICHE, which (for platform impl) is depending back on Envoy code.

I need to think more about if there's a way to resolve this. If anyone else has ideas/suggestions, please let me know. Argh...

@mpwarres
Copy link
Contributor Author

Hmm, one solution might be to restrict the QUICHE platform impl from depending on any Envoy libraries. Most if not all of it should be implementable on top of Abseil. Though that would be unfortunate in the case of things like e.g. logging, where it would be nice for QUICHE logging to go through the same logging pipeline as Envoy code.

If we go this route, it might argue for placing the platform impl somewhere outside of the Envoy source tree, i.e. as a separate repo that is brought in as an external dependency, itself (on which QUICHE would depend). I think htuch@ floated this as a possibility in earlier comments, even before this issue arose.

@mpwarres
Copy link
Contributor Author

I was able to find a solution to the link issue that allows QUICHE platform impl to depend on Envoy build targets--see bazel-discuss@ mail thread. @htuch, I think this is ready for another look.

@mpwarres
Copy link
Contributor Author

...and it looks like I spoke too soon. While build_image and clang_tidy now succeed, asan and tsan are still broken, due to some difference in the way they are set up. Looking at that now.

Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Yep, looks good now modulo remaining few comments. I think the TSAN/ASAN might be a Clang vs. gcc thing, but the Mac build is also Clang, so not sure. What is unfortunate is that looking at the TSAN build log, it seems to be the same issue that @ was supposed to fix..

# '@envoy' as the repository identifier. Otherwise, Bazel generates duplicate
# object files for the same build target (one under
# bazel-out/.../bin/external/, and one under bazel-out/.../bin/), eventually
# resulting in link-time errors.
Copy link
Member

Choose a reason for hiding this comment

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

Good find!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See latest top-level comment for an explanation of what's up with TSAN/ASAN. Basically it's because they build Envoy as an external dependency of the filter example.

@@ -0,0 +1,9 @@
#pragma once

// NOLINT(namespace-envoy)
Copy link
Member

Choose a reason for hiding this comment

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

Could you add comments to all the platform impl files just after the NOLINE explaining these are part of the QUICHE platform implementation, these are not consumed directly in Envoy and should not be referenced directly by any Envoy code, etc. This would make the style differences below more palatable. Thanks :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


// TODO: implement

#define VERIFY_AND_RETURN_SUCCESS(expression) 0
Copy link
Member

Choose a reason for hiding this comment

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

FWIW, I would love these in OSS gtest..

…eased.

Signed-off-by: Michael Warres <mpw@google.com>
…y Envoy code.

Signed-off-by: Michael Warres <mpw@google.com>
@mpwarres
Copy link
Contributor Author

mpwarres commented Jan 17, 2019

tl;dr: the linker issues are due to a Bazel bug that has already been fixed, but is not yet in an official Bazel release. I've confirmed that (with the QUICHE platform -> Envoy dependency) both regular and asan/tsan builds succeed with Bazel built at HEAD and the requisite feature flag flipped. Since the fix is not yet in the Bazel version used by CI, though, I have backed out the QUICHE platform -> Envoy dependency in this PR (as we do not need it immediately), and will add it back later on once the Bazel fix is present in the version we use.

I've also added the QUICHE platform comments requested, so I think this is ready for another pass.

Details: for the full story, read this bazel-discuss@ mail thread. It turns out we hit a known Bazel issue, bazelbuild/bazel#6848, which (in our case) caused references made by an external dependency (QUICHE) to "@envoy//foo:bar" to be considered external, even though "@envoy" designates the main workspace.

My earlier fix of changing the dependency to use "@//foo:bar" instead of "@envoy//foo:bar" worked for the default build since it forced the dependency to refer to the main workspace (i.e. "@"). However, this caused failures in the CI ASAN and TSAN builds because those build Envoy as an external dependency of envoy-filter-example, so in those setups, "@" resolved to the main workspace of envoy-filter-example, and not @envoy. (The context-dependent nature of "@" and its implications are explained most clearly in this message from the bazel-discuss@ thread.)

Eventually, once the fix for bazelbuild/bazel#6848 is in a release and made default behavior, dependency references to "@envoy//foo:bar" will resolve to the right place in both situations.

Signed-off-by: Michael Warres <mpw@google.com>
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

LGTM, thanks. Sorry about all the Bazel pain. If there are any unresolved issues please reach out to me offline, I can connect you directly with folks in Bazel team who can assist.

@htuch htuch merged commit 020c720 into envoyproxy:master Jan 18, 2019
@mpwarres
Copy link
Contributor Author

SG, will do if we run into other Bazel issues. Thanks for the review!

@mpwarres mpwarres deleted the import_quiche branch January 18, 2019 18:28
htuch pushed a commit that referenced this pull request Jan 23, 2019
Start populating QUICHE platform implementation.

Follows on #5548, fleshing out the framework for adding the Envoy implementation of the QUICHE platform (i.e. porting layer). Details:

* Add QUICHE spdy_platform and quic_platform build rules.
* Prune not yet implemented platform implementation files, to reduce noise.
* For partially complete platform implementation files, add "TODO: implement"
  comments to individual items that still need to be implemented.
* Add unit tests for platform APIs that have already been implemented.

Risk Level: minimal: code not used yet
Testing: unit tests

Signed-off-by: Michael Warres <mpw@google.com>
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Jan 24, 2019
Start populating QUICHE platform implementation.

Follows on envoyproxy#5548, fleshing out the framework for adding the Envoy implementation of the QUICHE platform (i.e. porting layer). Details:

* Add QUICHE spdy_platform and quic_platform build rules.
* Prune not yet implemented platform implementation files, to reduce noise.
* For partially complete platform implementation files, add "TODO: implement"
  comments to individual items that still need to be implemented.
* Add unit tests for platform APIs that have already been implemented.

Risk Level: minimal: code not used yet
Testing: unit tests

Signed-off-by: Michael Warres <mpw@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
@mpwarres
Copy link
Contributor Author

Tagging associated issue #2557

danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Jan 31, 2019
Start populating QUICHE platform implementation.

Follows on envoyproxy#5548, fleshing out the framework for adding the Envoy implementation of the QUICHE platform (i.e. porting layer). Details:

* Add QUICHE spdy_platform and quic_platform build rules.
* Prune not yet implemented platform implementation files, to reduce noise.
* For partially complete platform implementation files, add "TODO: implement"
  comments to individual items that still need to be implemented.
* Add unit tests for platform APIs that have already been implemented.

Risk Level: minimal: code not used yet
Testing: unit tests

Signed-off-by: Michael Warres <mpw@google.com>
fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
…oxy#5548)

QUICHE is Google's implementation of
QUIC and related protocols. It is the same code used in Chromium and Google's
servers, but packaged in a form that is intended to be easier to incorporate
into third-party projects.

QUICHE is still a work in progress, with current efforts focusing on
eliminating diffs between Google-internal and Chromium variants of the code, as
well as providing buildfiles and a default implementation of the QUICHE
platform API (the platform-dependent porting layer that sits underneath the
main body of QUICHE, which is platform-independent).

In the interim, the Google QUIC team has created a branch of QUICHE,
envoy-integration,
to provide access to the full set of QUICHE source files, while the work above
continues. Since Envoy can overlay its own build rules on top of external
dependencies, this should allow Envoy/QUICHE integration work to move forwards,
without being blocked by completion of "full" QUICHE. When QUICHE is fully
complete, we can just update the dependency to point to the official QUICHE
release, making whatever buildfile adjustments are necessary.

This PR is limited to setting up a basic import of QUICHE with a bare skeleton
of build rules to build and test one element of the platform API. The plan is
to add more build rules and platform implementation classes incrementally, in a
series of follow-on CLs. The end milestone of the platform implementation phase
will be when we can run the QUIC end-to-end tests included in QUICHE on top of
the Envoy platform implementation.

Risk Level: low--code not used yet
Testing: unit test to exercise build rules

Signed-off-by: Michael Warres <mpw@google.com>
Signed-off-by: Fred Douglas <fredlas@google.com>
fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
Start populating QUICHE platform implementation.

Follows on envoyproxy#5548, fleshing out the framework for adding the Envoy implementation of the QUICHE platform (i.e. porting layer). Details:

* Add QUICHE spdy_platform and quic_platform build rules.
* Prune not yet implemented platform implementation files, to reduce noise.
* For partially complete platform implementation files, add "TODO: implement"
  comments to individual items that still need to be implemented.
* Add unit tests for platform APIs that have already been implemented.

Risk Level: minimal: code not used yet
Testing: unit tests

Signed-off-by: Michael Warres <mpw@google.com>
Signed-off-by: Fred Douglas <fredlas@google.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.

3 participants