Commit 3defe3d
authored
update to Tokio 1.0 (#826)
This branch updates the proxy to Tokio 1.0 and its ecosystem, including:
- `tokio` 1.0 (obviously)
- the `tokio` 1.0 versions of `tokio-test` and `tokio-util`
- `bytes` 1.0
- `tower` 0.4
- `hyper` 0.14.2
- `h2` 0.3
- `tonic`, via git dependency
- `prost` 0.7
- `tokio-rustls` 0.22
- `rustls` 0.19
- `trust-dns-resolver` 0.20
- `linkerd2-proxy-api`, via git dependency
- `rand` 0.8
For the most part, the change here is pretty straightforward, just
updating the specified dependency versions. The API changes in `tokio`
were mostly made in 0.3, so we have already tracked most of them.
However, the following small changes were necessary:
- Hyper now has feature flags that must be enabled.
- `bytes` renamed `Buf::bytes` and `Buf::bytes_vectored` and
`BufMut::bytes_mut` to `chunk`, `chunk_vectored`, and `chunk_mut`,
respectively.
- `tokio::sync::Semaphore` now has a `close` method, and `acquire`
returns a `Result`. Updated `linkerd2-channel` to track this. This
also allowed removing some kind of janky jury-rigged code for closing
a semaphore.
- The `tokio::Runtime::builder::max_threads` method was renamed to
`max_blocking_threads`.
There were also a couple of larger changes. In particular:
- `tokio` no longer re-exports the `Stream` trait from `Futures`, for
stability reasons. I added a wrapper API for implementing `Stream` for
`mpsc` receivers and for `tokio::time::Interval`.
- `tokio::time::Sleep` is now `!Unpin`, since it no longer contains an
internal heap allocation. This reduces heap overhead when used with
async/await syntax. However, for manual `Future` and `tower::Service`
impls, the `Box` must be added _outside_ the `Sleep` to preserve
`Unpin`nedness. I've done this in all places where it was necessary. I
also changed some `Service` impls (`failfast` and `switch_ready`) which
repeatedly create new `Sleep` futures, to use `Sleep::reset` instead,
allowing them to avoid reallocations.
This also means that `tower`'s `Timeout` middleware's future is no
longer `Unpin`. Since connect futures are required to be `Unpin`, and
the connect stacks contain timeout layers, I added a new `BoxResponse`
middleware layer for boxing *just* response futures, while preserving
the type of the wrapped `Service` (so that connect stacks are still
`Clone`).
- Removed the `linkerd-app-profiling` crate, which has bit-rotted.
The latest `tower` release also adds upstream implementations of a
number of middlewares we've written our own versions of. As a follow-up,
we probably want to replace some of this stuff with the upstream
versions. However, I thought that we would probably want to do this in a
separate PR, to minimize the size of this change.1 parent ba87a15 commit 3defe3d
File tree
79 files changed
+642
-627
lines changed- hyper-balance
- linkerd2-proxy
- src
- linkerd
- app
- core
- gateway
- inbound
- src
- integration
- src
- tests
- outbound
- src
- http
- tcp
- src
- test
- src
- buffer
- cache
- channel
- src
- tests
- concurrency-limit
- src
- dns
- src
- drain
- duplex
- src
- error-metrics
- error-respond
- exp-backoff
- src
- http-box
- src
- http-classify
- http-metrics
- identity
- io
- metrics
- opencensus
- proxy
- api-resolve
- core
- discover
- dns-resolve
- src
- http
- identity
- tap
- src/grpc
- tcp
- transport
- reconnect
- retry
- service-profiles
- signal
- stack
- metrics
- src
- timeout
- src
- trace-context
- tracing
- src
- transport-header
- src
- opencensus-proto
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
79 files changed
+642
-627
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 66 | + | |
| 67 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | | - | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | | - | |
| 89 | + | |
| 90 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | 18 | | |
21 | 19 | | |
22 | | - | |
| 20 | + | |
23 | 21 | | |
24 | 22 | | |
25 | 23 | | |
26 | 24 | | |
27 | | - | |
| 25 | + | |
| 26 | + | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | | - | |
| 30 | + | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 123 | + | |
128 | 124 | | |
129 | 125 | | |
130 | 126 | | |
| |||
0 commit comments