Skip to content

update the core proxy components to std::future and tower 0.3#482

Merged
hawkw merged 28 commits intomaster-tokio-0.2from
eliza/0.2-serve
Apr 22, 2020
Merged

update the core proxy components to std::future and tower 0.3#482
hawkw merged 28 commits intomaster-tokio-0.2from
eliza/0.2-serve

Conversation

@hawkw
Copy link
Contributor

@hawkw hawkw commented Apr 16, 2020

This branch updates the core proxy components to use std::future and
tower 0.3. This includes most of the app crate and its components,
the transport crate, and some miscellaneous stuff in proxy that was
necessary for everything else to work.

I know this is a huge PR, but unfortunately, the coupling between these
crates made it kind of necessary. In theory, the proxy's constituent
crates are fairly loosely coupled, and in most cases, we don't need to
make this kind of cross-cutting change, but using Tower traits as an
interface is a big part of how we are able to implement this loose
coupling. Given the constraint that the master-tokio-0.2 branch should
always compile, I don't think it's possible to do the std::future
update without a branch like this.

Fortunately, although large, the change here is mostly pretty
mechanical. There's a lot of udpdating Service implementations to the
new Tower 0.3 version of the trait, including some slight tweaks to
future implementations to work with stack pinning. Some code (such as
tap and the controller client) had to be commented out to avoid having
to update additional proxy subsystems end-to-end in this branch; we will
update those components in follow-up PRs.

I haven't updated from tokio 0.1 async io to tokio 0.2 async IO; that
will be a later pass. This is because having both hyper 0.12 and
tokio 0.2 with the "net" feature in the dependency graph at the same
time pulls in incompatible iovec versions and is very hard to
untangle. hyper and the io types (the AsyncRead/Write traits,
sockets, etc) will have to move together.

Once this PR lands and the new Tower version is wired all the way
through the core of the proxy, it should be pretty easy to update the
rest of the crates in separate, independent PRs. We can essentially go
through the stack layer-by-layer, and update each component. Once that's
done, then we can circle back and update Hyper and the IO traits to the
Tokio 0.2 versions.

Closes #474 (it's contained in this branch and can't be merged
independently without breaking stuff)

hawkw added 8 commits April 15, 2020 14:08
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
@hawkw hawkw force-pushed the eliza/0.2-serve branch from b0255bc to 934bc5a Compare April 17, 2020 21:15
hawkw added 16 commits April 17, 2020 17:34
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
@hawkw hawkw changed the title [DRAFT] update proxy-core and transport to std::future update the core proxy components to std::future and tower 0.3 Apr 21, 2020
@hawkw hawkw requested review from adleong, kleimkuhler and olix0r April 21, 2020 17:45
@hawkw hawkw self-assigned this Apr 21, 2020
@hawkw hawkw marked this pull request as ready for review April 21, 2020 17:45
@olix0r
Copy link
Member

olix0r commented Apr 22, 2020

@hawkw what parts of this warrant the most attention in your opinion?

@hawkw
Copy link
Contributor Author

hawkw commented Apr 22, 2020

@hawkw what parts of this warrant the most attention in your opinion?

Honestly? None of it warrants that much attention. Large chunks of it is just commenting stuff out, and the rest is fairly mechanical translation from the old Service and Futures trait to the new. The Drain change is probably the biggest difference in implementation, and that was already reviewed in #474. I'd give it a skim to try and get a sense for the API differences, but there's only anything interesting in here if I've screwed up really badly.

@olix0r olix0r requested a review from a team April 22, 2020 16:28
Copy link
Contributor

@kleimkuhler kleimkuhler left a comment

Choose a reason for hiding this comment

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

Looks good! Not sure how much cleanup you'd like to stay on top of now vs once everything is done, but most of my comments are small non-blockers.

hawkw added 4 commits April 22, 2020 10:18
Thanks @kleimkuhler!

Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
@hawkw hawkw merged commit ade47fe into master-tokio-0.2 Apr 22, 2020
hawkw added a commit that referenced this pull request Jun 12, 2020
Although the `Drain` type which powers the proxy's graceful shutdown
machinery was updated in #482, we were not actually triggering graceful
shutdowns. This is because the Hyper `ConnectionFuture` was wrapped in a
compatibility adapter which did not allow access to the inner future so
that we could call the `graceful_shutdown` method on it. When we updated
to the `std::future` version of Hyper, the graceful shutdown code was
not re-enabled.

This branch puts back the call to `ConnectionFuture::graceful_shutdown`.
It also re-enables the shutdown integration tests, which pass now.

Signed-off-by: Eliza Weisman <[email protected]>
@olix0r olix0r deleted the eliza/0.2-serve branch May 25, 2021 15:46
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