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

proxy: Figure out the plan for Hyper 1.0 migration #8733

Open
olix0r opened this issue Jun 23, 2022 · 8 comments
Open

proxy: Figure out the plan for Hyper 1.0 migration #8733

olix0r opened this issue Jun 23, 2022 · 8 comments
Assignees

Comments

@olix0r
Copy link
Member

olix0r commented Jun 23, 2022

Hyper is planning a major 1.0 milestone that will impact many of their public APIs and, therefore, the proxy. We should get a better understanding of the planned changes so that we can begin to scope and plan the required proxy changes (and so that we can provide meaningful feedback before the APIs are finalized).


"here's some links!" -kate 💐 🧢

issues and pull requests related to upgrading linkerd2 to hyper 1.0:

in particular, this PR:

@olix0r olix0r added this to the stable-2.13.0 milestone Jun 23, 2022
@hawkw
Copy link
Contributor

hawkw commented Jun 23, 2022

Some of the things that are definitely worth keeping an eye on:

  • The future of hyper's use of the Service trait: whether hyper will use tower::Service in 1.0 is currently up in the air. If tower-service isn't 1.0 in time, it definitely won't. The question then becomes whether hyper will provide its own Service trait, or whether the interface will be changed significantly, potentially to one where user code calls into hyper.

    If hyper ends up moving away from tower-service, there will definitely need to be some kind of glue layer (which could be a generic tower-hyper crate or similar); the complexity of this adapter will depend on how different the interfaces end up being.

  • I/O traits: It's unclear whether hyper 1.0 is going to use Tokio's AsyncRead/AsyncWrite traits (as it does currently), or something else.

    • It seems like the use of the Tokio traits is more likely than the version from futures, but not set in stone, especially if there's an eventual plan for AsyncRead/AsyncWrite in std.
    • There are also questions about whether the style of async I/O traits currently in tokio and in futures-io can ever efficiently support io_uring-style async IO, where ownership of the buffer is transferred to the I/O resource (and then to the OS). This is a broader ecosystem-level question, but it's worth keeping an eye on.
  • A bunch of stuff currently in hyper will move to hyper-util. This one is not a huge deal as that should generally be a pretty mechanical transformation.

@stale
Copy link

stale bot commented Sep 21, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 21, 2022
@adleong adleong added pinned and removed wontfix labels Sep 22, 2022
@adleong adleong modified the milestones: stable-2.13.0, stable-2.14.0 Jan 19, 2023
@risingspiral risingspiral removed this from the stable-2.14.0 milestone Aug 4, 2023
@risingspiral
Copy link
Contributor

@cratelyn cratelyn self-assigned this Dec 2, 2024
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Dec 2, 2024
this is a prepatory chore, laying more ground to facilitate upgrading
our hyper dependency to the 1.0 major release. this commit adds the
`deprecated` cargo feature to each of the hyper dependencies in the
cargo workspace.

to prevent this from introducing a large number of compiler warnings to
the build, the `#[allow(deprecated)]` attribute is added to relevant
expressions.

these uses of deprecated interfaces will be updated in subsequent
commits. broadly, these fall into a few common cases:

* `hyper::client::conn::SendRequest` now has protocol specific `h1` and
  `h2` variants.

* `hyper::server::conn::Builder` now has protocol specific `h1` and
  `h2` variants.

* `hyper::server::conn::Http` is deprecated.

* functions like `hyper::body::aggregate(..)` and
  `hyper::body::to_bytes(..)` are deprecated.

see linkerd/linkerd2#8733 for more information
on the hyper 1.0 upgrade process.

Signed-off-by: katelyn martin <kate@buoyant.io>
@cratelyn
Copy link
Contributor

cratelyn commented Dec 2, 2024

i've been driving this work forward recently, and was kindly pointed at this issue by @olix0r. i thought i'd lay down some thoughts on the work done thus far:

first, i drove a few small exploratory spikes into upgrading the proxy here, here, and here.

most of the friction related to this upgrade will be found in the linkerd-proxy-http crate, which provides a number of core facilities wrapping hyper's client and server interfaces used throughout the rest of the proxy.

i've landed a few preparatory changes, in linkerd/linkerd2-proxy#3379, linkerd/linkerd2-proxy#3380, and linkerd/linkerd2-proxy#3382. these pulled assorted standalone bits of http/hyper infrastructure that define http_body::Body middleware out of the linkerd-proxy-http library, and into their own distinct crates.

this will let us bump linkerd-http-classify, linkerd-http-stream-timeouts, linkerd-http-retain, linkerd-http-override-authority, [..] and other linkerd-http-* crates up to hyper 1.0 in separate steps, which should both facilitate review and mitigate the risk of bugs slipping in while addressing the changes to the Body trait in particular.

🥚 🔜 🐣 next steps

next, we can use the deprecated and backports feature flags provided in the 0.14 minor release to further prepare for the upgrade.

linkerd/linkerd2-proxy#3405 adds the deprecated flag to the hyper dependencies in the cargo workspace, and #[allow(deprecated)] attributes to code using deprecated hyper interfaces.

next, we'll address those deprecations, making use of the backports feature. i've landed hyperium/hyper#3796 upstream to backport a 1.0 interface that we'll need before we can use the connection builder backported to 0.14.

cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Dec 3, 2024
this is a prepatory chore, laying more ground to facilitate upgrading
our hyper dependency to the 1.0 major release. this commit adds the
`deprecated` cargo feature to each of the hyper dependencies in the
cargo workspace.

to prevent this from introducing a large number of compiler warnings to
the build, the `#[allow(deprecated)]` attribute is added to relevant
expressions.

these uses of deprecated interfaces will be updated in subsequent
commits. broadly, these fall into a few common cases:

* `hyper::client::conn::SendRequest` now has protocol specific `h1` and
  `h2` variants.

* `hyper::server::conn::Builder` now has protocol specific `h1` and
  `h2` variants.

* `hyper::server::conn::Http` is deprecated.

* functions like `hyper::body::aggregate(..)` and
  `hyper::body::to_bytes(..)` are deprecated.

see linkerd/linkerd2#8733 for more information
on the hyper 1.0 upgrade process.

Signed-off-by: katelyn martin <kate@buoyant.io>
@cratelyn
Copy link
Contributor

cratelyn commented Dec 3, 2024

Some of the things that are definitely worth keeping an eye on:

* **The future of `hyper`'s use of the `Service` trait**: [whether `hyper` will use `tower::Service` in 1.0](https://github.com/hyperium/hyper/blob/master/docs/ROADMAP.md#service) is currently up in the air. If `tower-service` isn't 1.0 in time, it definitely won't. The question then becomes whether `hyper` will provide its own `Service` trait, or whether the interface will be changed significantly, [potentially to one where user code calls into `hyper`](https://github.com/hyperium/hyper/blob/master/docs/ROADMAP.md#you-call-hyper-or-hyper-calls-you).
  If hyper ends up moving away from `tower-service`, there will definitely need to be some kind of glue layer (which could be a generic `tower-hyper` crate or similar); the complexity of this adapter will depend on how different the interfaces end up being.

* **I/O traits**: It's unclear [whether `hyper` 1.0 is going to use Tokio's `AsyncRead`/`AsyncWrite` traits (as it does currently), or something else](https://github.com/hyperium/hyper/blob/master/docs/ROADMAP.md#runtime-woes).
  
  * It seems like the use of the Tokio traits is more likely than the version from `futures`, but not set in stone, especially if there's an eventual plan for `AsyncRead`/`AsyncWrite` in `std`.
  * There are also questions about whether the style of async I/O traits currently in `tokio` and in `futures-io` can ever efficiently support `io_uring`-style async IO, where ownership of the buffer is transferred to the I/O resource (and then to the OS).  This is a broader ecosystem-level question, but it's worth keeping an eye on.

* **A bunch of stuff currently in `hyper` will move to `hyper-util`.** This one is not a huge deal as that should _generally_ be a pretty mechanical transformation.

for the sake of closing the loop on the details above:

  • Service trait: hyper now provides its own Service trait. glue connecting tower to hyper lives in the hyper-util library: here.

  • I/O traits: hyper provides its own Read and Write traits. glue connecting this to tokio's traits lives in hyper-util::rt::tokio.

  • hyper-util motion: legacy client builder interfaces can be found in hyper_util::client::legacy. see hyper-util::server as well.

cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Dec 4, 2024
hyper 0.14.x provided a collection of interfaces related to collecting
and aggregating request and response bodies, which were deprecated and
removed in the 1.x major release.

this commit updates calls to `hyper::body::to_bytes(..)` and
`hyper::body::aggregate(..)`. for now, `http_body::Body` is used, but we
can use `http_body_util::BodyExt` once we've bumped our hyper dependency
to the 1.x major release.

for more information, see:

* linkerd/linkerd2#8733
* hyperium/hyper#2840
* hyperium/hyper#3020

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Dec 4, 2024
* chore(app/admin): add `http-body` dependency

before we address deprecated hyper interfaces related to `http_bodies`,
we'll want to add this dependency so that we can call `Body::collect()`.

Signed-off-by: katelyn martin <kate@buoyant.io>

* refactor(app): update deprecated hyper body calls

hyper 0.14.x provided a collection of interfaces related to collecting
and aggregating request and response bodies, which were deprecated and
removed in the 1.x major release.

this commit updates calls to `hyper::body::to_bytes(..)` and
`hyper::body::aggregate(..)`. for now, `http_body::Body` is used, but we
can use `http_body_util::BodyExt` once we've bumped our hyper dependency
to the 1.x major release.

for more information, see:

* linkerd/linkerd2#8733
* hyperium/hyper#2840
* hyperium/hyper#3020

Signed-off-by: katelyn martin <kate@buoyant.io>

---------

Signed-off-by: katelyn martin <kate@buoyant.io>
@cratelyn
Copy link
Contributor

cratelyn commented Dec 4, 2024

with linkerd/linkerd2-proxy#3405 landed, we're now in a good position to begin addressing particular deprecations in the hyper 0.14.31 interface to prepare the proxy for the hyper 1.0 upgrade.

linkerd/linkerd2-proxy#3411 is an example of one such change, handling calls to deprecated hyper::body functions such as e.g. aggregate().

cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Dec 4, 2024
this `Server` type is not used by any tests.

this commit removes it, to help facilitate the upgrade to the hyper 1.0
major release. see <linkerd/linkerd2#8733>.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Dec 4, 2024
this `Server` type is not used by any tests.

this commit removes it, to help facilitate the upgrade to the hyper 1.0
major release. see <linkerd/linkerd2#8733>.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Dec 6, 2024
#3427)

this branch contains a sequence of commits that focus on addressing
deprecation warnings related to hyper::client::conn::Builder. this
branch enables the backports feature, and then replaces some of these
builders with the backported, http/2 specific,
hyper::client::conn::http2::Builder type.

relates to linkerd/linkerd2#8733.

---

* chore(proxy/http): address `h2::Connection` deprecation

this commit updates `Connection<B>` to use the backported, http/2
specific `SendRequest` type.

this commit enables the `backports` feature flag in the `hyper`
dependency.

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(proxy/http): address `server::tests` deprecations

Signed-off-by: katelyn martin <kate@buoyant.io>

* refactor(proxy/http): consolidate connect functions

`connect()` is never called elsewhere. let's avoid the misdirection and
move it into the body of `connect_h2()`.

Signed-off-by: katelyn martin <kate@buoyant.io>

---------

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Dec 6, 2024
while handling the upgrade to hyper 1.0, i noticed some small changes
that'd be nice to make.

most importantly, with respect to
linkerd/linkerd2#8733, this commit outlines
`http_util::http_request()`. hyper 1.0 provides version specific
`SendRequest` types for HTTP/1 and HTTP/2, so rather than try to be
polymorphic across both senders, we send the request at the call site.

two other commits remove `pub` attributes for functions that aren't
called externally. we'll address `run_proxy()` and `connect_client()` in
a subsequent PR, because the dependent tests use both HTTP/1 and HTTP/2. 

---

* refactor(app/test): remove `pub` from `http_util::connect_client()`

this is not used elsewhere. it can be private.

Signed-off-by: katelyn martin <kate@buoyant.io>

* refactor(app/test): remove `pub` from `http_util::run_proxy()`

Signed-off-by: katelyn martin <kate@buoyant.io>

* refactor(app/test): remove `http_util::http_request()`

this function abstracts over one statement, at the cost of needing to
name the `SendRequest` type.

because hyper's 1.0 interface provides multiple `SendRequest` types
based on the HTTP version being used. to avoid needing to deal with
polymorphism, and to implicitly address a function-level allowance of
deprecated types, we remove this function and move this statement to the
function's call sites.

Signed-off-by: katelyn martin <kate@buoyant.io>

* refactor(app/test): collect bodies with `String::from_utf8`

this function previously called `std::str::from_utf8`, before calling
`str::to_owned` on the result. because of this, there is a bit of extra
gymnastics, passing a `&body[..]` slice along after collecting the body
bytes.

this is both more baroque and less performant. this commit updates the
call, using `String::from_utf8` to collect the body, sparing a needless
`to_owned()`/`clone()` call.

Signed-off-by: katelyn martin <kate@buoyant.io>

* docs(app/test): document `io` submodule

Signed-off-by: katelyn martin <kate@buoyant.io>

* refactor(app/test): remove duplicate `io` reëxport

the same `pub use` bundle is found in the parent `lib.rs`.

this removes it, and refers to the same `mod io {}` defined above.

Signed-off-by: katelyn martin <kate@buoyant.io>

* review(app/inbound): use `ServiceExt::oneshot(..)`

#3428 (comment)

we can simplify these statements sending requests, by using
`ServiceExt::oneshot(..)`.

Signed-off-by: katelyn martin <kate@buoyant.io>

---------

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Dec 6, 2024
this addresses hyper 1.0 deprecations in the server side of the inbound
proxy's http unit test suite logic.

see <linkerd/linkerd2#8733> for more
information.

the client end of this change ends up being slightly involved, due to
changes that will need to be made in `linkerd_app_test::http_util`.
accordingly, those deprecations will be addressed in a subsequent
commit.

Signed-off-by: katelyn martin <kate@buoyant.io>
olix0r pushed a commit to linkerd/drain-rs that referenced this issue Mar 7, 2025
this commit updates the tower dependency from `0.4.7` to `0.5.2`.

see also:
* linkerd/linkerd2#8733
* linkerd/linkerd2-proxy#3504

this allows us to rely upon newer versions of e.g. `axum`, `tonic`
without violating `cargo deny`'s duplicate dependency checks.

Signed-off-by: katelyn martin <me+cratelyn@katelyn.world>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 7, 2025
see linkerd/linkerd2#8733 for more
information.

see #3504 as well.

see #3456 (c740b6d), #3466 (ca50d6b), #3473 (b87455a), and #3701
(cf4ef39) for some other previous pr's that moved dependencies to be
managed at the workspace level.

see also linkerd/drain-rs#36 for another related
pull request that relates to our tower dependency.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 7, 2025
* chore(deps): `tower` is a workspace dependency

see linkerd/linkerd2#8733 for more
information.

see #3504 as well.

see #3456 (c740b6d), #3466 (ca50d6b), #3473 (b87455a), and #3701
(cf4ef39) for some other previous pr's that moved dependencies to be
managed at the workspace level.

see also linkerd/drain-rs#36 for another related
pull request that relates to our tower dependency.

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(deps): `tower-service` is a workspace dependency

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(deps): `tower-test` is a workspace dependency

Signed-off-by: katelyn martin <kate@buoyant.io>

---------

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 7, 2025
see linkerd/linkerd2#8733 and
#3504 for more
information.

see also linkerd/drain-rs#36 for a related pull request that
updated `drain`'s `tower` dependency. see #3715 (2f97549) for a related
pull request that made `tower` a workspace dependency.

see #3456 (c740b6d), #3466 (ca50d6b), #3473 (b87455a), and #3701
(cf4ef39), for some other previous pr's that moved dependencies to be
managed at the workspace level.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 7, 2025
see linkerd/linkerd2#8733 and
#3504 for more
information.

see also linkerd/drain-rs#36 for a related pull request that
updated `drain`'s `tower` dependency. see #3715 (2f97549) for a related
pull request that made `tower` a workspace dependency.

see #3456 (c740b6d), #3466 (ca50d6b), #3473 (b87455a), and #3701
(cf4ef39), for some other previous pr's that moved dependencies to be
managed at the workspace level.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 7, 2025
note: this commit will not compile, code changes are intentionally
elided from this commit.

this commit upgrades hyper, http, tonic, prost, related dependencies,
and their assorted cargo features.

see <linkerd/linkerd2#8733>.

---

squash:

chore(deps): add hyper-util workspace dependency

chore(deps): add http-body-util workspace dependency

chore(deps): upgrade linkerd2-proxy-api

this commit represents main as of linkerd/linkerd2-proxy-api#421.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 7, 2025
note: this commit will not compile, code changes are intentionally
elided from this commit.

this commit upgrades hyper, http, tonic, prost, related dependencies,
and their assorted cargo features.

see <linkerd/linkerd2#8733>.

---

squash:

chore(deps): add hyper-util workspace dependency

chore(deps): add http-body-util workspace dependency

chore(deps): upgrade linkerd2-proxy-api

this commit represents main as of linkerd/linkerd2-proxy-api#421.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 10, 2025
note: this commit will not compile, code changes are intentionally
elided from this commit.

this commit upgrades hyper, http, tonic, prost, related dependencies,
and their assorted cargo features.

see <linkerd/linkerd2#8733>.

---

squash:

chore(deps): add hyper-util workspace dependency

chore(deps): add http-body-util workspace dependency

chore(deps): upgrade linkerd2-proxy-api

this commit represents main as of linkerd/linkerd2-proxy-api#421.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 10, 2025
note: this commit will not compile, code changes are intentionally
elided from this commit.

this commit upgrades hyper, http, tonic, prost, related dependencies,
and their assorted cargo features.

see <linkerd/linkerd2#8733>.

see also:

* #3379
* #3380
* #3382
* #3405
* hyperium/hyper#3796
* #3411
* #3421
* #3427
* #3428
* #3432
* #3433
* #3444
* #3445
* #3454
* #3455
* #3456
* #3457
* #3461
* #3459
* #3465
* #3466
* #3467
* #3468
* linkerd/linkerd2-proxy-api#421
* linkerd/linkerd2#13492
* linkerd/linkerd2#13493
* hyperium/hyper#3816
* #3472
* #3473
* #3479
* tokio-rs/tokio#7059
* #3509
* hyperium/http-body#140
* #3515
* hyperium/http-body#141
* #3530
* #3531
* #3540
* #3556
* #3558
* #3559
* #3564
* #3567
* #3573
* #3583
* hyperium/http-body#144
* #3585
* #3586
* #3597
* #3598
* #3611
* #3614
* #3615
* #3616
* #3647
* #3651
* #3653
* #3654
* #3655
* #3656
* #3657
* #3660
* #3671
* #3672
* #3673
* #3676
* hyperium/http-body#147
* #3692
* #3699
* #3700
* #3701
* #3708
* linkerd/drain-rs#36
* #3715
* #3717
* eminence/procfs#340

---

squash:

chore(deps): add hyper-util workspace dependency

chore(deps): add http-body-util workspace dependency

chore(deps): upgrade linkerd2-proxy-api

this commit represents main as of linkerd/linkerd2-proxy-api#421.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 11, 2025
this commit makes a noöp change to the `SwitchReady<A, B>` machinery
provided by our `linkerd-stack` library.

this commit is a small refactor that is intended to pave the way for an
impending upgrade to tower v0.5, which notably includes breaking changes
to the `tower::util::Either<A, B>` service.

as of tower v0.5, by way of tower-rs/tower#637,
the `Either<A, B>` service is no longer itself a `Future`. so, we can
instead use the future provided by `futures`.

for more information, see:
* linkerd/linkerd2#8733
* #3504
* https://github.com/linkerd/linkerd2-proxy/pull/3504/files#r1988082658
* tower-rs/tower#637

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 11, 2025
this commit makes a noöp change to the `SwitchReady<A, B>` machinery
provided by our `linkerd-stack` library.

this commit is a small refactor that is intended to pave the way for an
impending upgrade to tower v0.5, which notably includes breaking changes
to the `tower::util::Either<A, B>` service.

as of tower v0.5, by way of tower-rs/tower#637,
the `Either<A, B>` service is no longer itself a `Future`. so, we can
instead use the future provided by `futures`.

for more information, see:
* linkerd/linkerd2#8733
* #3504
* https://github.com/linkerd/linkerd2-proxy/pull/3504/files#r1988082658
* tower-rs/tower#637

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 11, 2025
note: this commit will not compile, code changes are intentionally
elided from this commit.

this commit upgrades hyper, http, tonic, prost, related dependencies,
and their assorted cargo features.

see <linkerd/linkerd2#8733>.

see also:

* #3379
* #3380
* #3382
* #3405
* hyperium/hyper#3796
* #3411
* #3421
* #3427
* #3428
* #3432
* #3433
* #3444
* #3445
* #3454
* #3455
* #3456
* #3457
* #3461
* #3459
* #3465
* #3466
* #3467
* #3468
* linkerd/linkerd2-proxy-api#421
* linkerd/linkerd2#13492
* linkerd/linkerd2#13493
* hyperium/hyper#3816
* #3472
* #3473
* #3479
* tokio-rs/tokio#7059
* #3509
* hyperium/http-body#140
* #3515
* hyperium/http-body#141
* #3530
* #3531
* #3540
* #3556
* #3558
* #3559
* #3564
* #3567
* #3573
* #3583
* hyperium/http-body#144
* #3585
* #3586
* #3597
* #3598
* #3611
* #3614
* #3615
* #3616
* #3647
* #3651
* #3653
* #3654
* #3655
* #3656
* #3657
* #3660
* #3671
* #3672
* #3673
* #3676
* hyperium/http-body#147
* #3692
* #3699
* #3700
* #3701
* #3708
* linkerd/drain-rs#36
* #3715
* #3717
* eminence/procfs#340

---

squash:

chore(deps): add hyper-util workspace dependency

chore(deps): add http-body-util workspace dependency

chore(deps): upgrade linkerd2-proxy-api

this commit represents main as of linkerd/linkerd2-proxy-api#421.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 12, 2025
note: this commit will not compile, code changes are intentionally
elided from this commit.

this commit upgrades hyper, http, tonic, prost, related dependencies,
and their assorted cargo features.

see <linkerd/linkerd2#8733>.

see also:

* #3379
* #3380
* #3382
* #3405
* hyperium/hyper#3796
* #3411
* #3421
* #3427
* #3428
* #3432
* #3433
* #3444
* #3445
* #3454
* #3455
* #3456
* #3457
* #3461
* #3459
* #3465
* #3466
* #3467
* #3468
* linkerd/linkerd2-proxy-api#421
* linkerd/linkerd2#13492
* linkerd/linkerd2#13493
* hyperium/hyper#3816
* #3472
* #3473
* #3479
* tokio-rs/tokio#7059
* #3509
* hyperium/http-body#140
* #3515
* hyperium/http-body#141
* #3530
* #3531
* #3540
* #3556
* #3558
* #3559
* #3564
* #3567
* #3573
* #3583
* hyperium/http-body#144
* #3585
* #3586
* #3597
* #3598
* #3611
* #3614
* #3615
* #3616
* #3647
* #3651
* #3653
* #3654
* #3655
* #3656
* #3657
* #3660
* #3671
* #3672
* #3673
* #3676
* hyperium/http-body#147
* #3692
* #3699
* #3700
* #3701
* #3708
* linkerd/drain-rs#36
* #3715
* #3717
* eminence/procfs#340

---

squash:

chore(deps): add hyper-util workspace dependency

chore(deps): add http-body-util workspace dependency

chore(deps): upgrade linkerd2-proxy-api

this commit represents main as of linkerd/linkerd2-proxy-api#421.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 12, 2025
note: this commit will not compile, code changes are intentionally
elided from this commit.

this commit upgrades hyper, http, tonic, prost, related dependencies,
and their assorted cargo features.

see <linkerd/linkerd2#8733>.

see also:

* #3379
* #3380
* #3382
* #3405
* hyperium/hyper#3796
* #3411
* #3421
* #3427
* #3428
* #3432
* #3433
* #3444
* #3445
* #3454
* #3455
* #3456
* #3457
* #3461
* #3459
* #3465
* #3466
* #3467
* #3468
* linkerd/linkerd2-proxy-api#421
* linkerd/linkerd2#13492
* linkerd/linkerd2#13493
* hyperium/hyper#3816
* #3472
* #3473
* #3479
* tokio-rs/tokio#7059
* #3509
* hyperium/http-body#140
* #3515
* hyperium/http-body#141
* #3530
* #3531
* #3540
* #3556
* #3558
* #3559
* #3564
* #3567
* #3573
* #3583
* hyperium/http-body#144
* #3585
* #3586
* #3597
* #3598
* #3611
* #3614
* #3615
* #3616
* #3647
* #3651
* #3653
* #3654
* #3655
* #3656
* #3657
* #3660
* #3671
* #3672
* #3673
* #3676
* hyperium/http-body#147
* #3692
* #3699
* #3700
* #3701
* #3708
* linkerd/drain-rs#36
* #3715
* #3717
* eminence/procfs#340

---

squash:

chore(deps): add hyper-util workspace dependency

chore(deps): add http-body-util workspace dependency

chore(deps): upgrade linkerd2-proxy-api

this commit represents main as of linkerd/linkerd2-proxy-api#421.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 14, 2025
note: this commit will not compile, code changes are intentionally
elided from this commit.

this commit upgrades hyper, http, tonic, prost, related dependencies,
and their assorted cargo features.

see <linkerd/linkerd2#8733>.

see also:

* #3379
* #3380
* #3382
* #3405
* hyperium/hyper#3796
* #3411
* #3421
* #3427
* #3428
* #3432
* #3433
* #3444
* #3445
* #3454
* #3455
* #3456
* #3457
* #3461
* #3459
* #3465
* #3466
* #3467
* #3468
* linkerd/linkerd2-proxy-api#421
* linkerd/linkerd2#13492
* linkerd/linkerd2#13493
* hyperium/hyper#3816
* #3472
* #3473
* #3479
* tokio-rs/tokio#7059
* #3509
* hyperium/http-body#140
* #3515
* hyperium/http-body#141
* #3530
* #3531
* #3540
* #3556
* #3558
* #3559
* #3564
* #3567
* #3573
* #3583
* hyperium/http-body#144
* #3585
* #3586
* #3597
* #3598
* #3611
* #3614
* #3615
* #3616
* #3647
* #3651
* #3653
* #3654
* #3655
* #3656
* #3657
* #3660
* #3671
* #3672
* #3673
* #3676
* hyperium/http-body#147
* #3692
* #3699
* #3700
* #3701
* #3708
* linkerd/drain-rs#36
* #3715
* #3717
* eminence/procfs#340

---

squash:

chore(deps): add hyper-util workspace dependency

chore(deps): add http-body-util workspace dependency

chore(deps): upgrade linkerd2-proxy-api

this commit represents main as of linkerd/linkerd2-proxy-api#421.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 14, 2025
this commit updates our tower dependency from 0.4 to 0.5.

note that this commit does not affect the `tower-service` and
`tower-layer` crates, reëxported by `tower` itself. the `Service<T>`
trait and the closely related `Layer<S>` trait have not been changed.

the `tower` crate's utilities have changed in various ways, some of
particular note for the linkerd2 proxy. see these items, excerpted from
the tower changelog:

- **retry**: **Breaking Change** `retry::Policy::retry` now accepts `&mut Req` and `&mut Res` instead of the previous mutable versions. This
  increases the flexibility of the retry policy. To update, update your method signature to include `mut` for both parameters. ([#584])
- **retry**: **Breaking Change** Change Policy to accept &mut self ([#681])
- **retry**: Add generic backoff utilities ([#685])
- **retry**: **Breaking Change** `Budget` is now a trait. This allows end-users to implement their own budget and bucket implementations. ([#703])
- **util**: **Breaking Change** `Either::A` and `Either::B` have been renamed `Either::Left` and `Either::Right`, respectively. ([#637])
- **util**: **Breaking Change** `Either` now requires its two services to have the same error type. ([#637])
- **util**: **Breaking Change** `Either` no longer implemenmts `Future`. ([#637])
- **buffer**: **Breaking Change** `Buffer<S, Request>` is now generic over `Buffer<Request, S::Future>.` ([#654])

the `Either` trait bounds are particularly impactful for us.

* <tower-rs/tower@v0.4.x...master>
* <https://github.com/tower-rs/tower/blob/master/tower/CHANGELOG.md>
* <tower-rs/tower#815>
* <tower-rs/tower#817>
* <tower-rs/tower#818>

this work is based upon #3504. for more information, see:

* linkerd/linkerd2#8733
* #3504

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 14, 2025
this commit updates our tower dependency from 0.4 to 0.5.

note that this commit does not affect the `tower-service` and
`tower-layer` crates, reëxported by `tower` itself. the `Service<T>`
trait and the closely related `Layer<S>` trait have not been changed.

the `tower` crate's utilities have changed in various ways, some of
particular note for the linkerd2 proxy. see these items, excerpted from
the tower changelog:

- **retry**: **Breaking Change** `retry::Policy::retry` now accepts `&mut Req` and `&mut Res` instead of the previous mutable versions. This
  increases the flexibility of the retry policy. To update, update your method signature to include `mut` for both parameters. ([#584])
- **retry**: **Breaking Change** Change Policy to accept &mut self ([#681])
- **retry**: **Breaking Change** `Budget` is now a trait. This allows end-users to implement their own budget and bucket implementations. ([#703])
- **util**: **Breaking Change** `Either::A` and `Either::B` have been renamed `Either::Left` and `Either::Right`, respectively. ([#637])
- **util**: **Breaking Change** `Either` now requires its two services to have the same error type. ([#637])
- **util**: **Breaking Change** `Either` no longer implemenmts `Future`. ([#637])
- **buffer**: **Breaking Change** `Buffer<S, Request>` is now generic over `Buffer<Request, S::Future>.` ([#654])

see:

* <tower-rs/tower#584>
* <tower-rs/tower#681>
* <tower-rs/tower#703>
* <tower-rs/tower#637>
* <tower-rs/tower#654>

the `Either` trait bounds are particularly impactful for us. because
this runs counter to how we treat errors (skewing towards boxed errors,
in general), we temporarily vendor a version of `Either` from the 0.4
release, whose variants have been renamed to match the 0.5 interface.

updating to box the inner `A` and `B` services' errors, so we satiate
the new `A::Error = B::Error` bounds, can be addressed as a follow-on.
that's intentionally left as a separate change, due to the net size of
our patchset between this branch and #3504.

* <tower-rs/tower@v0.4.x...master>
* <https://github.com/tower-rs/tower/blob/master/tower/CHANGELOG.md>

this work is based upon #3504. for more information, see:

* linkerd/linkerd2#8733
* #3504

Signed-off-by: katelyn martin <kate@buoyant.io>
X-Ref: tower-rs/tower#815
X-Ref: tower-rs/tower#817
X-Ref: tower-rs/tower#818
X-Ref: tower-rs/tower#819
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 14, 2025
this commit updates our tower dependency from 0.4 to 0.5.

note that this commit does not affect the `tower-service` and
`tower-layer` crates, reëxported by `tower` itself. the `Service<T>`
trait and the closely related `Layer<S>` trait have not been changed.

the `tower` crate's utilities have changed in various ways, some of
particular note for the linkerd2 proxy. see these items, excerpted from
the tower changelog:

- **retry**: **Breaking Change** `retry::Policy::retry` now accepts `&mut Req` and `&mut Res` instead of the previous mutable versions. This
  increases the flexibility of the retry policy. To update, update your method signature to include `mut` for both parameters. ([tower-rs/tower#584])
- **retry**: **Breaking Change** Change Policy to accept &mut self ([tower-rs/tower#681])
- **retry**: **Breaking Change** `Budget` is now a trait. This allows end-users to implement their own budget and bucket implementations. ([tower-rs/tower#703])
- **util**: **Breaking Change** `Either::A` and `Either::B` have been renamed `Either::Left` and `Either::Right`, respectively. ([tower-rs/tower#637])
- **util**: **Breaking Change** `Either` now requires its two services to have the same error type. ([tower-rs/tower#637])
- **util**: **Breaking Change** `Either` no longer implemenmts `Future`. ([tower-rs/tower#637])
- **buffer**: **Breaking Change** `Buffer<S, Request>` is now generic over `Buffer<Request, S::Future>.` ([tower-rs/tower#654])

see:

* <tower-rs/tower#584>
* <tower-rs/tower#681>
* <tower-rs/tower#703>
* <tower-rs/tower#637>
* <tower-rs/tower#654>

the `Either` trait bounds are particularly impactful for us. because
this runs counter to how we treat errors (skewing towards boxed errors,
in general), we temporarily vendor a version of `Either` from the 0.4
release, whose variants have been renamed to match the 0.5 interface.

updating to box the inner `A` and `B` services' errors, so we satiate
the new `A::Error = B::Error` bounds, can be addressed as a follow-on.
that's intentionally left as a separate change, due to the net size of
our patchset between this branch and #3504.

* <tower-rs/tower@v0.4.x...master>
* <https://github.com/tower-rs/tower/blob/master/tower/CHANGELOG.md>

this work is based upon #3504. for more information, see:

* linkerd/linkerd2#8733
* #3504

Signed-off-by: katelyn martin <kate@buoyant.io>
X-Ref: tower-rs/tower#815
X-Ref: tower-rs/tower#817
X-Ref: tower-rs/tower#818
X-Ref: tower-rs/tower#819
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 18, 2025
note: this commit will not compile, code changes are intentionally
elided from this commit.

this commit upgrades hyper, http, tonic, prost, related dependencies,
and their assorted cargo features.

see <linkerd/linkerd2#8733>.

see also:

* #3379
* #3380
* #3382
* #3405
* hyperium/hyper#3796
* #3411
* #3421
* #3427
* #3428
* #3432
* #3433
* #3444
* #3445
* #3454
* #3455
* #3456
* #3457
* #3461
* #3459
* #3465
* #3466
* #3467
* #3468
* linkerd/linkerd2-proxy-api#421
* linkerd/linkerd2#13492
* linkerd/linkerd2#13493
* hyperium/hyper#3816
* #3472
* #3473
* #3479
* tokio-rs/tokio#7059
* #3509
* hyperium/http-body#140
* #3515
* hyperium/http-body#141
* #3530
* #3531
* #3540
* #3556
* #3558
* #3559
* #3564
* #3567
* #3573
* #3583
* hyperium/http-body#144
* #3585
* #3586
* #3597
* #3598
* #3611
* #3614
* #3615
* #3616
* #3647
* #3651
* #3653
* #3654
* #3655
* #3656
* #3657
* #3660
* #3671
* #3672
* #3673
* #3676
* hyperium/http-body#147
* #3692
* #3699
* #3700
* #3701
* #3708
* linkerd/drain-rs#36
* #3715
* #3717
* eminence/procfs#340

---

squash:

chore(deps): add hyper-util workspace dependency

chore(deps): add http-body-util workspace dependency

chore(deps): upgrade linkerd2-proxy-api

this commit represents main as of linkerd/linkerd2-proxy-api#421.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 18, 2025
this branch is motivated by [review feedback](#3504 (comment)) from #3504. see
linkerd/linkerd2#8733 for more information on upgrading `hyper`. there,
we asked:

> I wonder if we should be a little more defensive about cloning [`HttpConnect`]. What does cloning it mean? When handling a CONNECT request, we can't clone the request, really. (Technically, we can't clone the body, but practically, it means we can't clone the request). Can we easily track whether this was accidentally cloned (i.e. with a custom Clone impl or Arc or some such) and validate at runtime (i.e., in proxy::http::h1) that everything is copacetic?

`linkerd-http-upgrade` provides a `HttpConnect` type that is intended
for use as a response extension. this commit performs a refactor,
removing this type.

we use this extension in a single piece of tower middleware. typically,
these sorts of extensions are intended for e.g. passing state between
distinct layers of tower middleware, or otherwise facilitating
extensions to the HTTP family of protocols.

this extension is only constructed and subsequently referenced within a
single file, in the `linkerd_proxy_http::http::h1::Client`. we can
perform the same task by using the `is_http_connect` boolean we use to
conditionally insert this extension.

then, this branch removes a helper function for a computation whose
amortization is no longer as helpful. now that we are passing
`is_http_connect` down into this function, we are no longer inspecting
the response's extensions. because of that, the only work to do is to
check the status code, which is a very cheap comparison.

this also restates an `if version != HTTP_11 { .. }` conditional block as
a match statement. this is a code motion change, none of the inner blocks
are changed.

reviewers are encouraged to examine this branch commit-by-commit; because
of the sensitivity of this change, this refactor is performed in small,
methodical changes.

for posterity, i've run the linkerd/linkerd2 test suite against this branch, as of
linkerd/linkerd2@57dd7f4.

---

* refactor(http/upgrade): remove `HttpConnect` extension

`linkerd-http-upgrade` provides a `HttpConnect` type that is intended
for use as a response extension. this commit performs a refactor,
removing this type.

we use this extension in a single piece of tower middleware. typically,
these sorts of extensions are intended for e.g. passing state between
distinct layers of tower middleware, or otherwise facilitating
extensions to the HTTP family of protocols.

this extension is only constructed and subsequently referenced within a
single file, in the `linkerd_proxy_http::http::h1::Client`. we can
perform the same task by using the `is_http_connect` boolean we use to
conditionally insert this extension.

Signed-off-by: katelyn martin <kate@buoyant.io>

* refactor(proxy/http): fold helper function

this removes a helper function for a computation whose amortization is
no longer as helpful.

now that we are passing `is_http_connect` down into this function, we
are no longer inspecting the response's extensions. because of that, the
only work to do is to check the status code, which is a very cheap
comparison.

Signed-off-by: katelyn martin <kate@buoyant.io>

* refactor(proxy/http): match on response status

this commit refactors a sequence of conditional blocks in a helper
function used to identity HTTP/1.1 upgrades.

this commit replaces this sequence of conditional blocks with a match
statement.

Signed-off-by: katelyn martin <kate@buoyant.io>

* nit(proxy/http): rename `res` to `rsp`

we follow a convention where we tend to name responses `rsp`, not `res`
or `resp`. this commit applies that convention to this helper function.

Signed-off-by: katelyn martin <kate@buoyant.io>

* nit(proxy/http): import `Version`

Signed-off-by: katelyn martin <kate@buoyant.io>

* refactor(proxy/http): match on http version

this restates an `if version != HTTP_11 { .. }` conditional block as a
match statement.

this is a code motion change, none of the inner blocks are changed.

Signed-off-by: katelyn martin <kate@buoyant.io>

* refactor(proxy/http): add comments on http/1.1

this commit adds a brief comment noting that upgrades are a concept
specific to http/1.1.

Signed-off-by: katelyn martin <kate@buoyant.io>

---------

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 18, 2025
note: this commit will not compile, code changes are intentionally
elided from this commit.

this commit upgrades hyper, http, tonic, prost, related dependencies,
and their assorted cargo features.

see <linkerd/linkerd2#8733>.

see also:

* #3379
* #3380
* #3382
* #3405
* hyperium/hyper#3796
* #3411
* #3421
* #3427
* #3428
* #3432
* #3433
* #3444
* #3445
* #3454
* #3455
* #3456
* #3457
* #3461
* #3459
* #3465
* #3466
* #3467
* #3468
* linkerd/linkerd2-proxy-api#421
* linkerd/linkerd2#13492
* linkerd/linkerd2#13493
* hyperium/hyper#3816
* #3472
* #3473
* #3479
* tokio-rs/tokio#7059
* #3509
* hyperium/http-body#140
* #3515
* hyperium/http-body#141
* #3530
* #3531
* #3540
* #3556
* #3558
* #3559
* #3564
* #3567
* #3573
* #3583
* hyperium/http-body#144
* #3585
* #3586
* #3597
* #3598
* #3611
* #3614
* #3615
* #3616
* #3647
* #3651
* #3653
* #3654
* #3655
* #3656
* #3657
* #3660
* #3671
* #3672
* #3673
* #3676
* hyperium/http-body#147
* #3692
* #3699
* #3700
* #3701
* #3708
* linkerd/drain-rs#36
* #3715
* #3717
* eminence/procfs#340

---

squash:

chore(deps): add hyper-util workspace dependency

chore(deps): add http-body-util workspace dependency

chore(deps): upgrade linkerd2-proxy-api

this commit represents main as of linkerd/linkerd2-proxy-api#421.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 18, 2025
this commit updates our tower dependency from 0.4 to 0.5.

note that this commit does not affect the `tower-service` and
`tower-layer` crates, reëxported by `tower` itself. the `Service<T>`
trait and the closely related `Layer<S>` trait have not been changed.

the `tower` crate's utilities have changed in various ways, some of
particular note for the linkerd2 proxy. see these items, excerpted from
the tower changelog:

- **retry**: **Breaking Change** `retry::Policy::retry` now accepts `&mut Req` and `&mut Res` instead of the previous mutable versions. This
  increases the flexibility of the retry policy. To update, update your method signature to include `mut` for both parameters. ([tower-rs/tower#584])
- **retry**: **Breaking Change** Change Policy to accept &mut self ([tower-rs/tower#681])
- **retry**: **Breaking Change** `Budget` is now a trait. This allows end-users to implement their own budget and bucket implementations. ([tower-rs/tower#703])
- **util**: **Breaking Change** `Either::A` and `Either::B` have been renamed `Either::Left` and `Either::Right`, respectively. ([tower-rs/tower#637])
- **util**: **Breaking Change** `Either` now requires its two services to have the same error type. ([tower-rs/tower#637])
- **util**: **Breaking Change** `Either` no longer implemenmts `Future`. ([tower-rs/tower#637])
- **buffer**: **Breaking Change** `Buffer<S, Request>` is now generic over `Buffer<Request, S::Future>.` ([tower-rs/tower#654])

see:

* <tower-rs/tower#584>
* <tower-rs/tower#681>
* <tower-rs/tower#703>
* <tower-rs/tower#637>
* <tower-rs/tower#654>

the `Either` trait bounds are particularly impactful for us. because
this runs counter to how we treat errors (skewing towards boxed errors,
in general), we temporarily vendor a version of `Either` from the 0.4
release, whose variants have been renamed to match the 0.5 interface.

updating to box the inner `A` and `B` services' errors, so we satiate
the new `A::Error = B::Error` bounds, can be addressed as a follow-on.
that's intentionally left as a separate change, due to the net size of
our patchset between this branch and #3504.

* <tower-rs/tower@v0.4.x...master>
* <https://github.com/tower-rs/tower/blob/master/tower/CHANGELOG.md>

this work is based upon #3504. for more information, see:

* linkerd/linkerd2#8733
* #3504

Signed-off-by: katelyn martin <kate@buoyant.io>
X-Ref: tower-rs/tower#815
X-Ref: tower-rs/tower#817
X-Ref: tower-rs/tower#818
X-Ref: tower-rs/tower#819
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 21, 2025
## ✨ chore(deps): upgrade to hyperium 1.x crates

this branch performs an exciting upgrade for our proxy.

this branch upgrades a number of our dependencies so that we use the 1.0
release family of the `hyper` http framework, and its ecosystem. see the
[v1.0 announcement][hyper-v1] for more information.

this branch upgrades the following dependencies:

* `h2`: 0.3 -> 0.4
* `http`: 0.2 -> 1
* `http-body`: 0.4 -> 1
* `hyper`: 0.14.32 -> 1
* `prost`: 0.12 -> 0.13
* `prost-build`: 0.12 -> 0.13
* `prost-types`: 0.12 -> 0.13
* `tonic`: 0.10 -> 0.12
* `tonic-build`: 0.10 -> 0.12

a `hyper-util` dependency is added, which provides among other things,
legacy-compatible interfaces such as `hyper_util::client::legacy::Client`, or
glue to use `hyper` with the tokio runtime.

see <https://docs.rs/hyper-util/latest/hyper_util/> for more information.

a `http-body-util` dependency is added, which provides a `BodyExt` trait and a
channel-backed body for use in unit tests. the `deprecated` feature flag that
was active on our `0.14` hyper dependency has been removed, along with the
`stream` and `runtime` feature flags.

the `linkerd2-proxy-api` dependency is updated. see:
<linkerd/linkerd2-proxy-api#421>

### 📝 notes for review

bear particular attention to changes involving `http_body::Body` middleware.

the change from two separate `poll_data()` and `poll_trailers()` functions,
to a single `poll_frame()` method, induces some subtle changes to various
pieces of middleware.

also bear in mind that failing to set a timer, in our case
`hyper_util::rt::TokioTimer`, can cause http/2 clients, or http/1 and http/2
servers, to panic. make sure that any uses of
`hyper::server::conn::http1::Builder`, `hyper::client::conn::http1::Builder`,
or `hyper::client::conn::http2::Builder` install a timer.

### ❗ breaking change: `l5d-proxy-error` values

the `l5d-proxy-error` header can be examined to observe the cause of proxy
errors encountered when sending meshed traffic. by virtue of this using a newer
`hyper` client in the proxy, some error messages may in turn look different.
for example, an error like `"connect timed out after 1s"` may now appear as
`"client error (Connect)"`.

### 📚 other notes

this work, by virtue of touching so many parts of the system, is carried out
in distinct commits. an initial commit upgrades the dependencies at th
workspace level. subsequent commits will not compile if the `--workspace` flag
is provided, but the intent of this branch is to update each crate
individually.

use commands like, e.g. `cargo check --tests -p linkerd-proxy-http` to build
particular crates at intermediate commits within this branch.

this commit is also only the final leaf in an _extended_ line of work. this
has been done to mitigate the effort of reviewing this change, and the risk of
churn in the event of any unanticipated errors. see the top-level comment in
linkerd/linkerd2#8733 for an overview of all of the
work that brought us to this juncture.

[hyper-v1]: https://seanmonstar.com/blog/hyper-v1/

---

* chore(deps): upgrade to hyper 1.x

note: this commit will not compile, code changes are intentionally
elided from this commit.

this commit upgrades hyper, http, tonic, prost, related dependencies,
and their assorted cargo features.

see <linkerd/linkerd2#8733>.

see also:

* #3379
* #3380
* #3382
* #3405
* hyperium/hyper#3796
* #3411
* #3421
* #3427
* #3428
* #3432
* #3433
* #3444
* #3445
* #3454
* #3455
* #3456
* #3457
* #3461
* #3459
* #3465
* #3466
* #3467
* #3468
* linkerd/linkerd2-proxy-api#421
* linkerd/linkerd2#13492
* linkerd/linkerd2#13493
* hyperium/hyper#3816
* #3472
* #3473
* #3479
* tokio-rs/tokio#7059
* #3509
* hyperium/http-body#140
* #3515
* hyperium/http-body#141
* #3530
* #3531
* #3540
* #3556
* #3558
* #3559
* #3564
* #3567
* #3573
* #3583
* hyperium/http-body#144
* #3585
* #3586
* #3597
* #3598
* #3611
* #3614
* #3615
* #3616
* #3647
* #3651
* #3653
* #3654
* #3655
* #3656
* #3657
* #3660
* #3671
* #3672
* #3673
* #3676
* hyperium/http-body#147
* #3692
* #3699
* #3700
* #3701
* #3708
* linkerd/drain-rs#36
* #3715
* #3717
* eminence/procfs#340

---

squash:

chore(deps): add hyper-util workspace dependency

chore(deps): add http-body-util workspace dependency

chore(deps): upgrade linkerd2-proxy-api

this commit represents main as of linkerd/linkerd2-proxy-api#421.

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(http/box): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(hyper-balance): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(http/retain): ugrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(http/stream-timeouts): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(http/classify): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(http/upgrade): upgrade to hyper 1.x

NOTE: there is a comment noting that the upgrade middleware does not
expect to be cloneable. it is unfortunately, however, at odds with the
new bounds expected of extensions.

so, `Http11Upgrade` is now Clone'able, but a comment is left in place
noting this weakened invariant.

it's worth investigating how upgrades have changed since, in more
detail, but for the current moment we are interested in being
especially conservative about changing behavior, and focusing on api
changes like `Body::poll_frame(..)`.

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(metrics): upgrade to hyper 1.x

a brief note; this commit happened to tickle an unfortunate sharp edge
in `BoxBody` and `Full`'s respective constructors. type inference could
not figure out how to construct the body, so we refrain from boxing the
response body now.

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(http/metrics): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(http/prom): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(http/insert): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(http/retry): deprecate linkerd-http-body-compat

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(mock/http-body): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(http/retry): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(proxy/tap): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(proxy/http): update to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(app/core): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(app/test): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(app/admin): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(app/outbound): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(app/inbound): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(app/integration): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(app): upgrade to hyper 1.x

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(transport-header): update generated code

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(spiffe-proto): update generated code

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(opencensus-proto): update generated code

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(opentelemetry-proto): update generated code

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(deny.toml): update cargo-deny directives

this commit updates the contents of `deny.toml`.

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore: `compile` has been renamed to `compile_protos`

this addresses deprecation warnings, updating calls to a function that
has since been renamed.

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(deps): remove `linkerd-http-body-compat` dependencies

this commit removes this crate, which we added to future proof code for
this upgrade, from its dependents.

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(http/body-compat): remove `linkerd-http-body-compat` crate

Signed-off-by: katelyn martin <kate@buoyant.io>

* chore(deps): update to drain 0.2.1

see linkerd/drain-rs#41.

Signed-off-by: katelyn martin <kate@buoyant.io>

---------

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 21, 2025
this commit updates our tower dependency from 0.4 to 0.5.

note that this commit does not affect the `tower-service` and
`tower-layer` crates, reëxported by `tower` itself. the `Service<T>`
trait and the closely related `Layer<S>` trait have not been changed.

the `tower` crate's utilities have changed in various ways, some of
particular note for the linkerd2 proxy. see these items, excerpted from
the tower changelog:

- **retry**: **Breaking Change** `retry::Policy::retry` now accepts `&mut Req` and `&mut Res` instead of the previous mutable versions. This
  increases the flexibility of the retry policy. To update, update your method signature to include `mut` for both parameters. ([tower-rs/tower#584])
- **retry**: **Breaking Change** Change Policy to accept &mut self ([tower-rs/tower#681])
- **retry**: **Breaking Change** `Budget` is now a trait. This allows end-users to implement their own budget and bucket implementations. ([tower-rs/tower#703])
- **util**: **Breaking Change** `Either::A` and `Either::B` have been renamed `Either::Left` and `Either::Right`, respectively. ([tower-rs/tower#637])
- **util**: **Breaking Change** `Either` now requires its two services to have the same error type. ([tower-rs/tower#637])
- **util**: **Breaking Change** `Either` no longer implemenmts `Future`. ([tower-rs/tower#637])
- **buffer**: **Breaking Change** `Buffer<S, Request>` is now generic over `Buffer<Request, S::Future>.` ([tower-rs/tower#654])

see:

* <tower-rs/tower#584>
* <tower-rs/tower#681>
* <tower-rs/tower#703>
* <tower-rs/tower#637>
* <tower-rs/tower#654>

the `Either` trait bounds are particularly impactful for us. because
this runs counter to how we treat errors (skewing towards boxed errors,
in general), we temporarily vendor a version of `Either` from the 0.4
release, whose variants have been renamed to match the 0.5 interface.

updating to box the inner `A` and `B` services' errors, so we satiate
the new `A::Error = B::Error` bounds, can be addressed as a follow-on.
that's intentionally left as a separate change, due to the net size of
our patchset between this branch and #3504.

* <tower-rs/tower@v0.4.x...master>
* <https://github.com/tower-rs/tower/blob/master/tower/CHANGELOG.md>

this work is based upon #3504. for more information, see:

* linkerd/linkerd2#8733
* #3504

Signed-off-by: katelyn martin <kate@buoyant.io>
X-Ref: tower-rs/tower#815
X-Ref: tower-rs/tower#817
X-Ref: tower-rs/tower#818
X-Ref: tower-rs/tower#819
cratelyn added a commit to linkerd/linkerd2-proxy that referenced this issue Mar 21, 2025
* chore(deps)!: upgrade to tower 0.5

this commit updates our tower dependency from 0.4 to 0.5.

note that this commit does not affect the `tower-service` and
`tower-layer` crates, reëxported by `tower` itself. the `Service<T>`
trait and the closely related `Layer<S>` trait have not been changed.

the `tower` crate's utilities have changed in various ways, some of
particular note for the linkerd2 proxy. see these items, excerpted from
the tower changelog:

- **retry**: **Breaking Change** `retry::Policy::retry` now accepts `&mut Req` and `&mut Res` instead of the previous mutable versions. This
  increases the flexibility of the retry policy. To update, update your method signature to include `mut` for both parameters. ([tower-rs/tower#584])
- **retry**: **Breaking Change** Change Policy to accept &mut self ([tower-rs/tower#681])
- **retry**: **Breaking Change** `Budget` is now a trait. This allows end-users to implement their own budget and bucket implementations. ([tower-rs/tower#703])
- **util**: **Breaking Change** `Either::A` and `Either::B` have been renamed `Either::Left` and `Either::Right`, respectively. ([tower-rs/tower#637])
- **util**: **Breaking Change** `Either` now requires its two services to have the same error type. ([tower-rs/tower#637])
- **util**: **Breaking Change** `Either` no longer implemenmts `Future`. ([tower-rs/tower#637])
- **buffer**: **Breaking Change** `Buffer<S, Request>` is now generic over `Buffer<Request, S::Future>.` ([tower-rs/tower#654])

see:

* <tower-rs/tower#584>
* <tower-rs/tower#681>
* <tower-rs/tower#703>
* <tower-rs/tower#637>
* <tower-rs/tower#654>

the `Either` trait bounds are particularly impactful for us. because
this runs counter to how we treat errors (skewing towards boxed errors,
in general), we temporarily vendor a version of `Either` from the 0.4
release, whose variants have been renamed to match the 0.5 interface.

updating to box the inner `A` and `B` services' errors, so we satiate
the new `A::Error = B::Error` bounds, can be addressed as a follow-on.
that's intentionally left as a separate change, due to the net size of
our patchset between this branch and #3504.

* <tower-rs/tower@v0.4.x...master>
* <https://github.com/tower-rs/tower/blob/master/tower/CHANGELOG.md>

this work is based upon #3504. for more information, see:

* linkerd/linkerd2#8733
* #3504

Signed-off-by: katelyn martin <kate@buoyant.io>
X-Ref: tower-rs/tower#815
X-Ref: tower-rs/tower#817
X-Ref: tower-rs/tower#818
X-Ref: tower-rs/tower#819

* fix(stack/loadshed): update test affected by tower-rs/tower#635

this commit updates a test that was affected by breaking changes in
tower's `Buffer` middleware. see this excerpt from the description of
that change:

> I had to change some of the integration tests slightly as part of this
> change. This is because the buffer implementation using semaphore
> permits is _very subtly_ different from one using a bounded channel. In
> the `Semaphore`-based implementation, a semaphore permit is stored in
> the `Message` struct sent over the channel. This is so that the capacity
> is used as long as the message is in flight. However, when the worker
> task is processing a message that's been recieved from the channel,
> the permit is still not dropped. Essentially, the one message actively
> held by the worker task _also_ occupies one "slot" of capacity, so the
> actual channel capacity is one less than the value passed to the
> constructor, _once the first request has been sent to the worker_. The
> bounded MPSC changed this behavior so that capacity is only occupied
> while a request is actually in the channel, which broke some tests
> that relied on the old (and technically wrong) behavior.

bear particular attention to this:

> The bounded MPSC changed this behavior so that capacity is only
> occupied while a request is actually in the channel, which broke some
> tests that relied on the old (and technically wrong) behavior.

that pr adds an additional message to the channel in tests exercising
the laod-shedding behavior, on account of the previous (incorrect)
behavior.

https://github.com/tower-rs/tower/pull/635/files#r797108274

this commit performs the same change for our corresponding test, adding
an additional `ready()` call before we hit the buffer's limit.

Signed-off-by: katelyn martin <kate@buoyant.io>

* review: use vendored `Either` for consistency

#3744 (comment)

Signed-off-by: katelyn martin <kate@buoyant.io>

---------

Signed-off-by: katelyn martin <kate@buoyant.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants