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

update the proxy to use Tokio 0.3 #732

Merged
merged 73 commits into from Dec 4, 2020
Merged

update the proxy to use Tokio 0.3 #732

merged 73 commits into from Dec 4, 2020

Commits on Oct 30, 2020

  1. profiles: use tokio::sync::watch from Tokio 0.3

    It's possible that there's a memory leak in the Tokio 0.2 version of
    `tokio::sync::watch`. This commit updates the service-profiles code to
    use Tokio 0.3's version of watch, whose internals are significantly
    different.
    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    f9caaec View commit details
    Browse the repository at this point in the history
  2. update tower dependencies

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    4fc2f79 View commit details
    Browse the repository at this point in the history
  3. update hyper & tokio deps

    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    b383a78 View commit details
    Browse the repository at this point in the history
  4. replace all delays with sleeps

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    04960aa View commit details
    Browse the repository at this point in the history
  5. ye olde massive IO trait update

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    f133b7d View commit details
    Browse the repository at this point in the history
  6. update buffer to work with new mpsc

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    e165276 View commit details
    Browse the repository at this point in the history
  7. factor out poll_ready-able MPSC

    discovery::buffer also needs this
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    5e1ec7a View commit details
    Browse the repository at this point in the history
  8. use poll_readyable channel in discovery::buffer

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    ca9e6a4 View commit details
    Browse the repository at this point in the history
  9. fixup bytes compat situation

    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    771af19 View commit details
    Browse the repository at this point in the history
  10. senders are no longer mut

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    32111d0 View commit details
    Browse the repository at this point in the history
  11. use tower-request-modifier from before it became impossible to use

    turns out tower-rs/tower-http@926a64f
    made it more or less impossible for us to use the
    `tower-request-modifier` crate. it now returns services with `impl
    FnOnce` in their types, so we can't return it from `NewService` or
    `MakeService` impls.
    
    i'll fix this upstream eventually but for now let's just pin to the
    revision before it got that way.
    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    9932337 View commit details
    Browse the repository at this point in the history
  12. fixy fixy fixy

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    8e98e5d View commit details
    Browse the repository at this point in the history
  13. update test stuff

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    0c5024f View commit details
    Browse the repository at this point in the history
  14. use new rt builder

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Oct 30, 2020
    Configuration menu
    Copy the full SHA
    c8e4473 View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2020

  1. update tonic

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 3, 2020
    Configuration menu
    Copy the full SHA
    85fba37 View commit details
    Browse the repository at this point in the history
  2. update integration tests

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 3, 2020
    Configuration menu
    Copy the full SHA
    89bddc6 View commit details
    Browse the repository at this point in the history
  3. trust-dns requires tokio 0.2

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 3, 2020
    Configuration menu
    Copy the full SHA
    dacdd5e View commit details
    Browse the repository at this point in the history
  4. update tests

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 3, 2020
    Configuration menu
    Copy the full SHA
    6a47e5b View commit details
    Browse the repository at this point in the history
  5. hyper bump, etc

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 3, 2020
    Configuration menu
    Copy the full SHA
    f289243 View commit details
    Browse the repository at this point in the history

Commits on Nov 5, 2020

  1. tokio 0.3 requires us to set O_NONBLOCK ourselves

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 5, 2020
    Configuration menu
    Copy the full SHA
    5497ed5 View commit details
    Browse the repository at this point in the history
  2. test support sockets also need O_NONBLOCK

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 5, 2020
    Configuration menu
    Copy the full SHA
    821af2c View commit details
    Browse the repository at this point in the history
  3. fix channel max permits overflow

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 5, 2020
    Configuration menu
    Copy the full SHA
    5bb8083 View commit details
    Browse the repository at this point in the history
  4. put back set_keepalive

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 5, 2020
    Configuration menu
    Copy the full SHA
    c7c3a7e View commit details
    Browse the repository at this point in the history

Commits on Nov 6, 2020

  1. use the same h2 version has hyper does

    this fixes error types not downcasting since different versions of h2
    are in tree
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 6, 2020
    Configuration menu
    Copy the full SHA
    f9d367a View commit details
    Browse the repository at this point in the history
  2. pick up fix for missing EOFs (hyperium/hyper#2322)

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 6, 2020
    Configuration menu
    Copy the full SHA
    3d1d220 View commit details
    Browse the repository at this point in the history
  3. use the same h2 version as hyper 2: electric h2

    tests and metrics also rely on h2 error downcasting
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 6, 2020
    Configuration menu
    Copy the full SHA
    6a58672 View commit details
    Browse the repository at this point in the history

Commits on Nov 9, 2020

  1. Configuration menu
    Copy the full SHA
    f471335 View commit details
    Browse the repository at this point in the history

Commits on Nov 12, 2020

  1. drain: update to tokio 0.3

    This branch updates the `linkerd2-drain` crate to use Tokio 0.3's
    synchronization primitives, and replace the `oneshot` channel with
    `watch` (removing the weird `future::Shared` nonsense).
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 12, 2020
    Configuration menu
    Copy the full SHA
    869c702 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    00771f8 View commit details
    Browse the repository at this point in the history

Commits on Nov 13, 2020

  1. lockfile stuff

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 13, 2020
    Configuration menu
    Copy the full SHA
    c23e58a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8545bf8 View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2020

  1. Merge branch 'main' into eliza/tokio-0.3

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 18, 2020
    Configuration menu
    Copy the full SHA
    6a7195b View commit details
    Browse the repository at this point in the history

Commits on Nov 25, 2020

  1. Configuration menu
    Copy the full SHA
    c4375f0 View commit details
    Browse the repository at this point in the history
  2. fixup tests

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 25, 2020
    Configuration menu
    Copy the full SHA
    1ed36a7 View commit details
    Browse the repository at this point in the history
  3. fix test io expecting to be read

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 25, 2020
    Configuration menu
    Copy the full SHA
    743156c View commit details
    Browse the repository at this point in the history
  4. WIP: update hyper, bytes, and friends

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Nov 25, 2020
    Configuration menu
    Copy the full SHA
    1f03099 View commit details
    Browse the repository at this point in the history

Commits on Dec 1, 2020

  1. update proxy-api

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    f7e68f1 View commit details
    Browse the repository at this point in the history
  2. update prost

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    c8ac96a View commit details
    Browse the repository at this point in the history
  3. hopefully works with the new hyper upgrade api?

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    bb9a527 View commit details
    Browse the repository at this point in the history
  4. update tests

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    492d3d5 View commit details
    Browse the repository at this point in the history
  5. wip put back upgrade body

    hawkw committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    45e943d View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2020

  1. h1 upgrades work now

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 2, 2020
    Configuration menu
    Copy the full SHA
    9fc1591 View commit details
    Browse the repository at this point in the history
  2. fix wrong http bodiy bytes conversion in tests

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 2, 2020
    Configuration menu
    Copy the full SHA
    959c5d6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a3841d2 View commit details
    Browse the repository at this point in the history
  4. excise tokio-compat stuff

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 2, 2020
    Configuration menu
    Copy the full SHA
    116cc74 View commit details
    Browse the repository at this point in the history

Commits on Dec 3, 2020

  1. Configuration menu
    Copy the full SHA
    88629ec View commit details
    Browse the repository at this point in the history
  2. fix manual lockfile surgery

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    9e7d70d View commit details
    Browse the repository at this point in the history
  3. io: don't vendor poll_read_buf

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    11f0649 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5cff808 View commit details
    Browse the repository at this point in the history
  5. Merge main

    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    b1d60da View commit details
    Browse the repository at this point in the history
  6. io: put back writev tests

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    ce5536e View commit details
    Browse the repository at this point in the history
  7. io: put back BoxedIo writev forwarding

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    41e59c3 View commit details
    Browse the repository at this point in the history
  8. fix every other asyncwrite not forwarding writev

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    561d971 View commit details
    Browse the repository at this point in the history
  9. io: use poll_write_buf from tokio-util

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    573b419 View commit details
    Browse the repository at this point in the history
  10. fixup duplex

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    8a111bf View commit details
    Browse the repository at this point in the history
  11. fixup duplex

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    5b3fc01 View commit details
    Browse the repository at this point in the history
  12. minimize lockfile changes

    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    86e1fbe View commit details
    Browse the repository at this point in the history
  13. rustfmt

    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    4f2c218 View commit details
    Browse the repository at this point in the history
  14. also update tracing

    This tracks the change that added an `instrument` combinator in the main
    `tracing` crate.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    1660e26 View commit details
    Browse the repository at this point in the history
  15. de-async-ify dns construction

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    42567a9 View commit details
    Browse the repository at this point in the history
  16. rm patch for tokio-util

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    c3ee5a7 View commit details
    Browse the repository at this point in the history
  17. another rustfmt

    hawkw committed Dec 3, 2020
    Configuration menu
    Copy the full SHA
    8900cdd View commit details
    Browse the repository at this point in the history

Commits on Dec 4, 2020

  1. switch buffers to use Tokio 0.3 channels

    This branch updates `linkerd2-buffer`, and `linkerd2-proxy-discover`'s
    `buffer` module to use Tokio 0.3's MPSC channel rather than Tokio 0.2's.
    The rest of the proxy still uses Tokio 0.2, including the 0.2 runtime.
    
    Most of the Tokio synchronization primitives lost their `poll`-based
    interfaces in 0.3 as part of the move to intrusive lists of wakers for
    synchronization primitives (see tokio-rs/tokio#2325,
    tokio-rs/tokio#2509, and tokio-rs/tokio#2861). This change takes
    advantage of the inherently pinned nature of `async fn` and `async`
    blocks to avoid needing a separate heap allocation to store the waiter
    state for a task waiting on a synchronization primitive. However, it
    means that a synchronization primitive can _only_ be waited on when the
    future that waits on it is pinned --- otherwise, there is a potential
    dangling pointer. The `poll`-based APIs allowed waiting on
    synchronization primitives from unpinned contexts, so they were removed.
    
    To wait on the synchronization primitives from contexts that may not be
    pinned, such as `poll_ready`, it's necessary to add a `Pin<Box<...>>`
    around the future that's waiting on the synchronization primitive. This
    ensures that the future will not move while it's part of the wait list.
    It's important to note that this isn't an _additional_ allocation per
    waiter versus Tokio 0.2; instead, it's the same allocation that would
    have _always_ happened internally to the synchronization primitive in
    the 0.2 API. Now, it's moved outside of the `tokio::sync` type so that
    it can be avoided when used with `async`/`await` syntax, and added by
    the user when polling the sync primitives.
    
    Because we need to poll channel senders in `tower::Service`
    implementations' `poll_ready` functions, it was necessary to introduce
    our own bounded MPSC channel type that exposes a polling-based API. When
    the buffer's channel is full, we want to exert backpressure in
    `poll_ready`, so that callers such as load balancers could choose to
    call another service rather than waiting for buffer capacity. This
    branch adds a new `linkerd2-channel` crate that implements a pollable
    bounded channel, wrapping `tokio::sync`'s unbounded MPSC and using a
    `tokio::sync::Semaphore` to implement bounding. It's worth noting that
    this is, essentially, how `tokio::sync::mpsc`'s bounded channel is
    implemented --- it also uses the semaphore. However, our implementation
    exposes a `poll_ready` method by boxing the future that waits to acquire
    a semaphore permit, which the Tokio channel does not expose.
    
    This was factored out of PR #732.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    598c9be View commit details
    Browse the repository at this point in the history
  2. add tests based on Tokio's

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    eb24cd8 View commit details
    Browse the repository at this point in the history
  3. let's just use tokio's error types

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    14cc5a7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0d02957 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8e1503e View commit details
    Browse the repository at this point in the history
  6. fix lockfile

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    50bebf3 View commit details
    Browse the repository at this point in the history
  7. transport: comment on socket conversion safety etc

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    cb9e35c View commit details
    Browse the repository at this point in the history
  8. remove unneeded debug impl

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    1568cb1 View commit details
    Browse the repository at this point in the history
  9. clean up git deps & patches

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    fd28ef0 View commit details
    Browse the repository at this point in the history
  10. update proxy-api deps

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    8129573 View commit details
    Browse the repository at this point in the history
  11. update the proxy to use Tokio 0.3

    This branch updates the proxy to use Tokio 0.3 and the Tokio 0.3
    versions of various ecosystem crates. This includes `tower` 0.4 and
    `bytes` 0.6, as well as the Tokio 0.3 versions of `tokio-util`, `hyper`,
    `tonic`, etc. Due to API changes in Tokio and in other dependencies, it
    was necessary to make some code changes as well as updating
    dependencies, but there should be no functional change.
    
    In particular:
    * Tokio's support for vectored IO changed significantly in 0.3, so this
      branch updates our use of `AsyncWrite` to participate in the new
      vectored write APIs
    * Hyper's HTTP/1.1 upgrade API changed in 0.14, so this branch changes the
      proxy's code for handling CONNECT to use the new API
    * Tokio removed support for some socket options, which now need to be
      set using `socket2`
    * Tokio removed the `poll_ready` method was removed from the bounded
      MPSC channel, so the proxy's buffers (`linkerd2-buffer` and the
      `buffer` module in `linkerd2-proxy-discover`) had to be switched to
      our own implementation (this merged separately, in PR #759).
    
    Several ecosystem crates have yet to be released, so we depend on them
    via Git dependencies for now. The patches in Cargo.toml can be
    removed as other dependencies publish their Tokio 0.3 versions.
    hawkw committed Dec 4, 2020
    Configuration menu
    Copy the full SHA
    3642a18 View commit details
    Browse the repository at this point in the history