Skip to content

mobile: allow using a light listener manager#24363

Merged
alyssawilk merged 21 commits intoenvoyproxy:mainfrom
alyssawilk:api_listener_manager
Dec 14, 2022
Merged

mobile: allow using a light listener manager#24363
alyssawilk merged 21 commits intoenvoyproxy:mainfrom
alyssawilk:api_listener_manager

Conversation

@alyssawilk
Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk commented Dec 5, 2022

This enables using Envoy Mobile from the real downstream listener manger to a lightweight listener manager, allowing compiling out all the downstream listener code.

The real listener is still by default. This should be largely a no-op for everything but the c++ CI.

Risk Level: low
Testing: c++ ci regression tests new code paths.
Docs Changes: n/a
Release Notes: n/a

Part of envoyproxy/envoy-mobile#2711

@repokitteh-read-only
Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #24363 was opened by alyssawilk.

see: more, trace.

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/mobile-maintainers: FYI only for changes made to (mobile/).
envoyproxy/mobile-maintainers assignee is @Augustyniak

🐱

Caused by: #24363 was opened by alyssawilk.

see: more, trace.

@alyssawilk
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 #24363 (comment) was created by @alyssawilk.

see: more, trace.

@alyssawilk alyssawilk force-pushed the api_listener_manager branch 2 times, most recently from 1dc4db7 to fdc3eaa Compare December 6, 2022 18:48
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk alyssawilk force-pushed the api_listener_manager branch from fdc3eaa to c19cdd7 Compare December 8, 2022 20:38
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk alyssawilk marked this pull request as ready for review December 8, 2022 20:51
--build_tests_only \
$([ -z $GITHUB_TOKEN ] || echo "--config=remote-ci-linux-clang") \
--remote_header="Authorization=Bearer $GITHUB_TOKEN" \
--copt=-DALLOW_TCP_LISTENERS --remote_header="Authorization=Bearer $GITHUB_TOKEN" \
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.

Can this be moved to a .bazelrc config?

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.

The goal here is to have E-M build without TCP listeners, but we exempt it for this CI due to the proxying tests. will comment inline.

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.

But then these tests will fail when run locally?

Why not add build test --copt=-DALLOW_TCP_LISTENERS to the .bazelrc so it works both on CI and locally?

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.

because then all tests will always run with TCP listeners, and we won't have regression testing for, say, the C++ tests running without TCP listeners.

What I'm hearing is you'd prefer I add it to the bazelrc, and explicitly not allow TCP listeners on all the non-legacy CI instead?

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.

Hmm, yeah I was thinking a config that we could pass when running these tests specifically, but then it doesn't make much difference if you have to pass a config or a --copt because either way ./bazelw test ... won't be sufficient.

I'm ok keeping this as-is then.

@jpsim
Copy link
Copy Markdown
Contributor

jpsim commented Dec 8, 2022

The real listener is still used if Envoy Mobile is compiled with --copt=-DALLOW_TCP_LISTENERS as evidenced by the kotlin build.

Why does Kotlin need to build with the real listener?

@jpsim
Copy link
Copy Markdown
Contributor

jpsim commented Dec 8, 2022

Release Notes: maybe should have for E-M?

We have release notes in https://github.com/envoyproxy/envoy/blob/main/mobile/docs/root/intro/version_history.rst

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Copy Markdown
Contributor Author

Also adding in Snow for the changes to Envoy. Mind taking a look? Very minimal PR.

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@Augustyniak
Copy link
Copy Markdown
Contributor

A discussion related to this PR happened in Slack. The current hypothesis is that #24294 broke objc hello world app CI job which was disabled in #24363 to 'unblock' main (make it green again).

We think that your PR may fix objc hello world app issue but to test it we would need to re-enable the aforementioned job. Could we verify whether your PR fixes the objc hello world app CI job?

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Copy Markdown
Contributor Author

Ok CI reinstated and passing (needed a different force-register)

Augustyniak added a commit that referenced this pull request Dec 12, 2022
Commit Message:
Additional Description: Register default listener. Envoy Mobile crashes in optimized builds without this change. The crash was introduced in #24294. The objc hello world app CI job was disabled in #24363 to make main green again.
Risk Level: Low
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional [API Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):]
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
deps = [
"extension_registry_platform_additions",
"@envoy//source/common/network:socket_lib",
"@envoy//source/common/quic:quic_transport_socket_factory_lib",
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.

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk alyssawilk changed the title mobile: switch to a light listener manager mobile: allow using a light listener manager Dec 13, 2022
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@Augustyniak
Copy link
Copy Markdown
Contributor

Why does Kotlin need to build with the real listener?

It's needed by Android proxy tests which spam 2 instances of Envoy Mobile, one of which acts as a "fake" proxy and uses the default/complex listener to handle incoming requests.

Copy link
Copy Markdown
Contributor

@Augustyniak Augustyniak left a comment

Choose a reason for hiding this comment

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

Left a comment with regard to including the new api listener based on the value of the introduced flag.

It's not a hard blocker but it's worth noting that the size of the binary will actually go up by a tiny bit until we do not remove the old listener and if we always include the new listener as part of the build. Based on JP's numbers for the size increase I am not worried about the size increase tho (as it appears to be tiny).

Envoy::Network::forceRegisterGetAddrInfoDnsResolverFactory();
Envoy::Extensions::RequestId::forceRegisterUUIDRequestIDExtensionFactory();
Envoy::Server::forceRegisterDefaultListenerManagerFactoryImpl();
Envoy::Server::forceRegisterApiListenerManagerFactoryImpl();
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.

should we force register in here only if DUSE_API_LISTENER is set?

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 was going to do that but I think it requires a bazel flag and additional plumbing to be useful given the library include

"@envoy_mobile//library/common/extensions/filters/http/platform_bridge:config",
"@envoy_mobile//library/common/extensions/filters/http/route_cache_reset:config",
"@envoy_mobile//library/common/extensions/filters/http/socket_tag:config",
"@envoy_mobile//library/common/extensions/listener_managers/api_listener_manager:api_listener_manager_lib",
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.

similar to my other comment - should we include this dep only if the new compiler/build flag is set?

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 it depends. if the long term plan is to have a bazel flag to have it optional, we can add it now. if long term we want to say E-M is a client library not a proxy, I'm inclined to not do the busy-work which I'd then have to unwind, and accept the additional include in the interim (we can remove it in-housE)

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.

actually having thought a bit more I think it is sensible to have a flag but I would like to add it when we flip the default, so have one for "enable TCP listener" where right now we have compile support for "enable API listener"

@alyssawilk alyssawilk enabled auto-merge (squash) December 14, 2022 18:12
@alyssawilk alyssawilk merged commit f15c4a1 into envoyproxy:main Dec 14, 2022
@alyssawilk alyssawilk deleted the api_listener_manager branch April 5, 2023 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants