diff --git a/Cargo.lock b/Cargo.lock index 8c80a2cf09..d220736d59 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,14 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "addr2line" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49806b9dadc843c61e7c97e72490ad7f7220ae249012fbda9ad0609457c0543" -dependencies = [ - "gimli", -] - [[package]] name = "adler32" version = "1.0.2" @@ -66,7 +57,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22068c0c19514942eefcfd4daf8976ef1aad84e61539f95cd200c35202f80af5" dependencies = [ - "async-stream-impl", + "async-stream-impl 0.2.1", + "futures-core", +] + +[[package]] +name = "async-stream" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3670df70cbc01729f901f94c887814b3c68db038aad1329a418bae178bc5295c" +dependencies = [ + "async-stream-impl 0.3.0", "futures-core", ] @@ -81,11 +82,22 @@ dependencies = [ "syn", ] +[[package]] +name = "async-stream-impl" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3548b8efc9f8e8a5a0a2808c5bd8451a9031b9e5b879a79590304ae928b0a70" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "async-trait" -version = "0.1.31" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c4f3195085c36ea8d24d32b2f828d23296a9370a28aa39d111f6f16bef9f3b" +checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d" dependencies = [ "proc-macro2", "quote", @@ -104,19 +116,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" -[[package]] -name = "backtrace" -version = "0.3.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df2f85c8a2abbe3b7d7e748052fdd9b76a0458fdeb16ad4223f5eca78c7c130" -dependencies = [ - "addr2line", - "cfg-if 0.1.10", - "libc", - "object", - "rustc-demangle", -] - [[package]] name = "base64" version = "0.10.1" @@ -132,12 +131,30 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +[[package]] +name = "bitvec" +version = "0.19.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7ba35e9565969edb811639dbebfe34edc0368e472c5018474c8eb2543397f81" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "build_const" version = "0.2.0" @@ -172,6 +189,12 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" +[[package]] +name = "bytes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0dcbc35f504eb6fc275a6d20e4ebcda18cf50d40ba6fabff8c711fa16cb3b16" + [[package]] name = "c2-chacha" version = "0.2.3" @@ -248,12 +271,12 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.4.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ - "crossbeam-utils", - "maybe-uninit", + "cfg-if 1.0.0", + "crossbeam-utils 0.8.1", ] [[package]] @@ -267,6 +290,23 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" +dependencies = [ + "autocfg 1.0.0", + "cfg-if 1.0.0", + "lazy_static", +] + +[[package]] +name = "data-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993a608597367c6377b258c25d7120740f00ed23a2252b729b1932dd7866f908" + [[package]] name = "deflate" version = "0.7.18" @@ -341,20 +381,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" +name = "funty" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +checksum = "0ba62103ce691c2fd80fbae2213dfdda9ce60804973ac6b6e97de818ea7f52c8" [[package]] name = "futures" @@ -451,7 +481,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr 2.3.3", - "pin-project", + "pin-project 0.4.22", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -482,12 +512,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "gimli" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" - [[package]] name = "gzip-header" version = "0.1.2" @@ -500,52 +524,53 @@ dependencies = [ [[package]] name = "h2" -version = "0.1.26" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" +checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" dependencies = [ - "byteorder", - "bytes 0.4.11", + "bytes 0.5.4", "fnv", - "futures 0.1.26", - "http 0.1.21", + "futures-core", + "futures-sink", + "futures-util", + "http", "indexmap", - "log", "slab", - "string", - "tokio-io", + "tokio 0.2.23", + "tokio-util 0.3.1", + "tracing", ] [[package]] name = "h2" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" +version = "0.3.0" +source = "git+https://github.com/hyperium/h2#dc3079ab89ca9fa7b79e014f5b2a835f30f4916b" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.1", + "http", "indexmap", "slab", - "tokio 0.2.23", - "tokio-util", + "tokio 0.3.5", + "tokio-util 0.5.1", "tracing", + "tracing-futures", ] [[package]] name = "hdrhistogram" -version = "7.1.0" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3c22708574c44e924720c5b3a116326c688e6d532f438c77c007ec8768644f9" +checksum = "af54a13c410de2b5e2d611475072834b86d7b2f835a2a8f7b1b1248d3e9bfbd8" dependencies = [ - "base64 0.12.3", + "base64 0.13.0", "byteorder", "crossbeam-channel", "flate2", - "nom 5.1.2", + "nom 6.0.1", "num-traits 0.2.6", ] @@ -593,17 +618,6 @@ dependencies = [ "utf8-width", ] -[[package]] -name = "http" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0" -dependencies = [ - "bytes 0.4.11", - "fnv", - "itoa", -] - [[package]] name = "http" version = "0.2.1" @@ -617,12 +631,11 @@ dependencies = [ [[package]] name = "http-body" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +version = "0.4.0" +source = "git+https://github.com/hyperium/http-body#5e434739e747c0b6611ec41020740b17f735d25a" dependencies = [ - "bytes 0.5.4", - "http 0.2.1", + "bytes 0.6.0", + "http", ] [[package]] @@ -632,24 +645,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" [[package]] -name = "hyper" -version = "0.13.7" +name = "httpdate" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e68a8dd9716185d9e64ea473ea6ef63529252e3e27623295a0378a19665d5eb" +checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" + +[[package]] +name = "hyper" +version = "0.14.0-dev" +source = "git+https://github.com/hyperium/hyper?rev=d6aadb830072959497f414c01bcdba4c8e681088#d6aadb830072959497f414c01bcdba4c8e681088" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "futures-channel", "futures-core", "futures-util", - "h2 0.2.6", - "http 0.2.1", + "h2 0.3.0", + "http", "http-body", "httparse", + "httpdate", "itoa", - "pin-project", + "pin-project 1.0.2", "socket2", - "time", - "tokio 0.2.23", + "tokio 0.3.5", "tower-service", "tracing", "want", @@ -660,10 +678,10 @@ name = "hyper-balance" version = "0.1.0" dependencies = [ "futures 0.3.5", - "http 0.2.1", + "http", "hyper", - "pin-project", - "tokio 0.2.23", + "pin-project 0.4.22", + "tokio 0.3.5", "tokio-test 0.2.1", "tower", ] @@ -729,9 +747,9 @@ checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" [[package]] name = "itertools" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" dependencies = [ "either", ] @@ -805,7 +823,7 @@ checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" name = "linkerd2-addr" version = "0.1.0" dependencies = [ - "http 0.2.1", + "http", "linkerd2-dns-name", ] @@ -823,7 +841,7 @@ dependencies = [ "linkerd2-error", "linkerd2-opencensus", "regex 1.3.9", - "tokio 0.2.23", + "tokio 0.3.5", "tonic", "tower", "tracing", @@ -834,9 +852,9 @@ dependencies = [ name = "linkerd2-app-core" version = "0.1.0" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "futures 0.3.5", - "http 0.2.1", + "http", "http-body", "hyper", "indexmap", @@ -879,11 +897,11 @@ dependencies = [ "linkerd2-timeout", "linkerd2-trace-context", "linkerd2-tracing", - "pin-project", + "pin-project 0.4.22", "procinfo", "prost-types", "regex 1.3.9", - "tokio 0.2.23", + "tokio 0.3.5", "tokio-timer", "tonic", "tower", @@ -897,12 +915,13 @@ name = "linkerd2-app-gateway" version = "0.1.0" dependencies = [ "futures 0.3.5", - "http 0.2.1", + "http", "indexmap", "linkerd2-app-core", "linkerd2-app-inbound", "linkerd2-app-outbound", - "tokio 0.2.23", + "linkerd2-app-test", + "tokio 0.3.5", "tokio-test 0.2.1", "tower", "tower-test", @@ -913,12 +932,12 @@ dependencies = [ name = "linkerd2-app-inbound" version = "0.1.0" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "futures 0.3.5", - "http 0.2.1", + "http", "indexmap", "linkerd2-app-core", - "tokio 0.2.23", + "tokio 0.3.5", "tower", "tracing", ] @@ -927,11 +946,11 @@ dependencies = [ name = "linkerd2-app-integration" version = "0.1.0" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "flate2", "futures 0.3.5", - "h2 0.2.6", - "http 0.2.1", + "h2 0.3.0", + "http", "http-body", "hyper", "linkerd2-app", @@ -942,7 +961,7 @@ dependencies = [ "regex 0.1.80", "rustls", "socket2", - "tokio 0.2.23", + "tokio 0.3.5", "tokio-rustls", "tonic", "tower", @@ -956,9 +975,9 @@ dependencies = [ name = "linkerd2-app-outbound" version = "0.1.0" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "futures 0.3.5", - "http 0.2.1", + "http", "hyper", "indexmap", "ipnet 1.0.0", @@ -967,8 +986,8 @@ dependencies = [ "linkerd2-identity", "linkerd2-io", "linkerd2-retry", - "pin-project", - "tokio 0.2.23", + "pin-project 0.4.22", + "tokio 0.3.5", "tower", "tracing", "tracing-futures", @@ -979,7 +998,7 @@ name = "linkerd2-app-profiling" version = "0.1.0" dependencies = [ "linkerd2-app-integration", - "tokio 0.2.23", + "tokio 0.3.5", ] [[package]] @@ -987,14 +1006,14 @@ name = "linkerd2-app-test" version = "0.1.0" dependencies = [ "futures 0.3.5", - "h2 0.2.6", - "http 0.2.1", + "h2 0.3.0", + "http", "http-body", "hyper", "linkerd2-app-core", "regex 0.1.80", - "tokio 0.2.23", - "tokio-test 0.2.1", + "tokio 0.3.5", + "tokio-test 0.3.0", "tower", "tracing", "tracing-futures", @@ -1008,8 +1027,8 @@ dependencies = [ "futures 0.3.5", "linkerd2-channel", "linkerd2-error", - "pin-project", - "tokio 0.2.23", + "pin-project 0.4.22", + "tokio 0.3.5", "tokio-test 0.2.1", "tower", "tower-test", @@ -1044,7 +1063,7 @@ name = "linkerd2-concurrency-limit" version = "0.1.0" dependencies = [ "futures 0.3.5", - "pin-project", + "pin-project 0.4.22", "tokio 0.2.23", "tower", "tracing", @@ -1061,8 +1080,8 @@ dependencies = [ "futures 0.3.5", "linkerd2-dns-name", "linkerd2-error", - "pin-project", - "tokio 0.2.23", + "pin-project 0.4.22", + "tokio 0.3.5", "tracing", "trust-dns-resolver", ] @@ -1081,19 +1100,20 @@ version = "0.1.0" dependencies = [ "futures 0.3.5", "linkerd2-error", - "pin-project", - "tokio 0.2.23", - "tokio-test 0.2.1", + "pin-project 0.4.22", + "tokio 0.3.5", + "tokio-test 0.3.0", ] [[package]] name = "linkerd2-duplex" version = "0.1.0" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "futures 0.3.5", - "pin-project", - "tokio 0.2.23", + "linkerd2-io", + "pin-project 0.4.22", + "tokio 0.3.5", "tracing", ] @@ -1115,7 +1135,7 @@ dependencies = [ "futures 0.3.5", "indexmap", "linkerd2-metrics", - "pin-project", + "pin-project 0.4.22", "tower", ] @@ -1125,7 +1145,7 @@ version = "0.1.0" dependencies = [ "futures 0.3.5", "linkerd2-error", - "pin-project", + "pin-project 0.4.22", "tower", ] @@ -1134,22 +1154,22 @@ name = "linkerd2-exp-backoff" version = "0.1.0" dependencies = [ "futures 0.3.5", - "pin-project", + "pin-project 0.4.22", "quickcheck", "rand 0.7.2", - "tokio 0.2.23", + "tokio 0.3.5", ] [[package]] name = "linkerd2-http-box" version = "0.1.0" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "futures 0.3.5", - "http 0.2.1", + "http", "http-body", "linkerd2-error", - "pin-project", + "pin-project 0.4.22", "tower", ] @@ -1157,7 +1177,7 @@ dependencies = [ name = "linkerd2-http-classify" version = "0.1.0" dependencies = [ - "http 0.2.1", + "http", "linkerd2-error", "linkerd2-stack", "tower", @@ -1167,10 +1187,10 @@ dependencies = [ name = "linkerd2-http-metrics" version = "0.1.0" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "futures 0.3.5", - "h2 0.1.26", - "http 0.2.1", + "h2 0.3.0", + "http", "http-body", "hyper", "indexmap", @@ -1178,7 +1198,7 @@ dependencies = [ "linkerd2-http-classify", "linkerd2-metrics", "linkerd2-stack", - "pin-project", + "pin-project 0.4.22", "tower", "tracing", ] @@ -1199,13 +1219,14 @@ dependencies = [ name = "linkerd2-io" version = "0.1.0" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "futures 0.3.5", "linkerd2-errno", - "pin-project", - "tokio 0.2.23", + "pin-project 0.4.22", + "tokio 0.3.5", "tokio-rustls", - "tokio-test 0.2.1", + "tokio-test 0.3.0", + "tokio-util 0.5.1", ] [[package]] @@ -1215,7 +1236,7 @@ dependencies = [ "deflate", "futures 0.3.5", "hdrhistogram", - "http 0.2.1", + "http", "hyper", "indexmap", "parking_lot", @@ -1229,12 +1250,12 @@ name = "linkerd2-opencensus" version = "0.1.0" dependencies = [ "futures 0.3.5", - "http 0.2.1", + "http", "http-body", "linkerd2-error", "linkerd2-metrics", "opencensus-proto", - "pin-project", + "pin-project 0.4.22", "tokio 0.2.23", "tonic", "tower", @@ -1250,17 +1271,17 @@ dependencies = [ "linkerd2-signal", "mimalloc", "num_cpus", - "tokio 0.2.23", + "tokio 0.3.5", "tracing", ] [[package]] name = "linkerd2-proxy-api" version = "0.1.15" -source = "git+https://github.com/linkerd/linkerd2-proxy-api?tag=v0.1.15#d260ea21a0e490d863a9ed02bcc051035be9d238" +source = "git+https://github.com/linkerd/linkerd2-proxy-api?rev=259628840ba613c2e5673fc6a39b946e1b06f09a#259628840ba613c2e5673fc6a39b946e1b06f09a" dependencies = [ "h2 0.2.6", - "http 0.2.1", + "http", "prost", "prost-types", "quickcheck", @@ -1273,15 +1294,15 @@ dependencies = [ name = "linkerd2-proxy-api-resolve" version = "0.1.0" dependencies = [ - "async-stream", + "async-stream 0.2.1", "futures 0.3.5", - "http 0.2.1", + "http", "http-body", "indexmap", "linkerd2-identity", "linkerd2-proxy-api", "linkerd2-proxy-core", - "pin-project", + "pin-project 0.4.22", "prost", "tonic", "tower", @@ -1294,7 +1315,7 @@ version = "0.1.0" dependencies = [ "futures 0.3.5", "linkerd2-error", - "pin-project", + "pin-project 0.4.22", "tower", ] @@ -1302,15 +1323,15 @@ dependencies = [ name = "linkerd2-proxy-discover" version = "0.1.0" dependencies = [ - "async-stream", + "async-stream 0.2.1", "futures 0.3.5", "indexmap", "linkerd2-channel", "linkerd2-error", "linkerd2-proxy-core", "linkerd2-stack", - "pin-project", - "tokio 0.2.23", + "pin-project 0.4.22", + "tokio 0.3.5", "tower", "tracing", "tracing-futures", @@ -1325,7 +1346,7 @@ dependencies = [ "linkerd2-dns", "linkerd2-error", "linkerd2-proxy-core", - "tokio 0.2.23", + "tokio 0.3.5", "tower", "tracing", "tracing-futures", @@ -1335,10 +1356,10 @@ dependencies = [ name = "linkerd2-proxy-http" version = "0.1.0" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "futures 0.3.5", - "h2 0.2.6", - "http 0.2.1", + "h2 0.3.0", + "http", "http-body", "httparse", "hyper", @@ -1352,9 +1373,9 @@ dependencies = [ "linkerd2-io", "linkerd2-stack", "linkerd2-timeout", - "pin-project", + "pin-project 1.0.2", "rand 0.7.2", - "tokio 0.2.23", + "tokio 0.3.5", "tower", "tracing", "tracing-futures", @@ -1371,8 +1392,8 @@ dependencies = [ "linkerd2-identity", "linkerd2-proxy-api", "linkerd2-proxy-transport", - "pin-project", - "tokio 0.2.23", + "pin-project 0.4.22", + "tokio 0.3.5", "tonic", "tracing", ] @@ -1384,7 +1405,7 @@ dependencies = [ "futures 0.3.5", "linkerd2-error", "linkerd2-proxy-core", - "pin-project", + "pin-project 0.4.22", "tower", "tracing", ] @@ -1393,9 +1414,8 @@ dependencies = [ name = "linkerd2-proxy-tap" version = "0.1.0" dependencies = [ - "bytes 0.5.4", "futures 0.3.5", - "http 0.2.1", + "http", "hyper", "indexmap", "ipnet 2.3.0", @@ -1406,10 +1426,10 @@ dependencies = [ "linkerd2-proxy-http", "linkerd2-proxy-transport", "linkerd2-stack", - "pin-project", + "pin-project 0.4.22", "prost-types", "rand 0.7.2", - "tokio 0.2.23", + "tokio 0.3.5", "tonic", "tower", "tracing", @@ -1424,9 +1444,9 @@ dependencies = [ "linkerd2-duplex", "linkerd2-error", "linkerd2-stack", - "pin-project", + "pin-project 0.4.22", "rand 0.7.2", - "tokio 0.2.23", + "tokio 0.3.5", "tower", ] @@ -1434,8 +1454,8 @@ dependencies = [ name = "linkerd2-proxy-transport" version = "0.1.0" dependencies = [ - "async-stream", - "bytes 0.5.4", + "async-stream 0.2.1", + "bytes 0.6.0", "futures 0.3.5", "indexmap", "libc", @@ -1447,11 +1467,12 @@ dependencies = [ "linkerd2-io", "linkerd2-metrics", "linkerd2-stack", - "pin-project", + "pin-project 0.4.22", "rustls", - "tokio 0.2.23", + "socket2", + "tokio 0.3.5", "tokio-rustls", - "tokio-util", + "tokio-util 0.5.1", "tower", "tracing", "tracing-futures", @@ -1467,7 +1488,7 @@ dependencies = [ "futures 0.3.5", "linkerd2-error", "linkerd2-stack", - "pin-project", + "pin-project 0.4.22", "tower", "tracing", ] @@ -1478,7 +1499,7 @@ version = "0.1.0" dependencies = [ "linkerd2-error", "linkerd2-stack", - "pin-project", + "pin-project 0.4.22", "tower", "tracing", ] @@ -1487,9 +1508,10 @@ dependencies = [ name = "linkerd2-service-profiles" version = "0.1.0" dependencies = [ - "bytes 0.5.4", + "async-stream 0.3.0", + "bytes 0.6.0", "futures 0.3.5", - "http 0.2.1", + "http", "http-body", "indexmap", "linkerd2-addr", @@ -1498,12 +1520,12 @@ dependencies = [ "linkerd2-proxy-api", "linkerd2-proxy-api-resolve", "linkerd2-stack", - "pin-project", + "pin-project 0.4.22", "prost-types", "quickcheck", "rand 0.7.2", "regex 1.3.9", - "tokio 0.2.23", + "tokio 0.3.5", "tonic", "tower", "tracing", @@ -1514,7 +1536,7 @@ dependencies = [ name = "linkerd2-signal" version = "0.1.0" dependencies = [ - "tokio 0.2.23", + "tokio 0.3.5", "tracing", ] @@ -1525,8 +1547,8 @@ dependencies = [ "dyn-clone", "futures 0.3.5", "linkerd2-error", - "pin-project", - "tokio 0.2.23", + "pin-project 0.4.22", + "tokio 0.3.5", "tokio-test 0.2.1", "tower", "tower-test", @@ -1550,7 +1572,7 @@ dependencies = [ "futures 0.3.5", "linkerd2-error", "linkerd2-stack", - "pin-project", + "pin-project 0.4.22", "tower", "tracing", "tracing-futures", @@ -1563,8 +1585,8 @@ dependencies = [ "futures 0.3.5", "linkerd2-error", "linkerd2-stack", - "pin-project", - "tokio 0.2.23", + "pin-project 0.4.22", + "tokio 0.3.5", "tokio-connect", "tokio-test 0.2.1", "tower", @@ -1577,10 +1599,10 @@ name = "linkerd2-trace-context" version = "0.1.0" dependencies = [ "base64 0.10.1", - "bytes 0.5.4", + "bytes 0.6.0", "futures 0.3.5", "hex", - "http 0.2.1", + "http", "linkerd2-error", "linkerd2-stack", "rand 0.7.2", @@ -1593,9 +1615,9 @@ dependencies = [ name = "linkerd2-tracing" version = "0.1.0" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "html-escape", - "http 0.2.1", + "http", "hyper", "linkerd2-error", "serde_json", @@ -1617,9 +1639,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.6" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" dependencies = [ "cfg-if 0.1.10", ] @@ -1667,12 +1689,6 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" version = "0.1.11" @@ -1731,63 +1747,22 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.21" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" +checksum = "f33bc887064ef1fd66020c9adfc45bb9f33d75a42096c81e7c56c65b75dd1a8b" dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", "libc", "log", - "miow 0.2.1", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-named-pipes" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" -dependencies = [ - "log", - "mio", - "miow 0.3.5", + "miow", + "ntapi", "winapi 0.3.8", ] -[[package]] -name = "mio-uds" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" -dependencies = [ - "iovec", - "libc", - "mio", -] - -[[package]] -name = "miow" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - [[package]] name = "miow" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" +checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" dependencies = [ "socket2", "winapi 0.3.8", @@ -1799,17 +1774,6 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8883adfde9756c1d30b0f519c9b8c502a94b41ac62f696453c37c7fc0a958ce" -[[package]] -name = "net2" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9044faf1413a1057267be51b5afba8eb1090bd2231c693664aa1db716fe1eae0" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.8", -] - [[package]] name = "nom" version = "2.2.1" @@ -1818,15 +1782,25 @@ checksum = "cf51a729ecf40266a2368ad335a5fdde43471f545a967109cd62146ecf8b66ff" [[package]] name = "nom" -version = "5.1.2" +version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" +checksum = "88034cfd6b4a0d54dd14f4a507eceee36c0b70e5a02236c4e4df571102be17f0" dependencies = [ + "bitvec", "lexical-core", "memchr 2.3.3", "version_check", ] +[[package]] +name = "ntapi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2" +dependencies = [ + "winapi 0.3.8", +] + [[package]] name = "num-integer" version = "0.1.39" @@ -1861,12 +1835,6 @@ dependencies = [ "libc", ] -[[package]] -name = "object" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2" - [[package]] name = "once_cell" version = "1.5.2" @@ -1877,7 +1845,7 @@ checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" name = "opencensus-proto" version = "0.1.0" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "prost", "prost-types", "tonic", @@ -1932,7 +1900,16 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17" dependencies = [ - "pin-project-internal", + "pin-project-internal 0.4.22", +] + +[[package]] +name = "pin-project" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ccc2237c2c489783abd8c4c80e5450fc0e98644555b1364da68cc29aa151ca7" +dependencies = [ + "pin-project-internal 1.0.2", ] [[package]] @@ -1946,6 +1923,17 @@ dependencies = [ "syn", ] +[[package]] +name = "pin-project-internal" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" version = "0.1.4" @@ -2006,20 +1994,18 @@ dependencies = [ [[package]] name = "prost" version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce49aefe0a6144a45de32927c77bd2859a5f7677b55f220ae5b744e87389c212" +source = "git+https://github.com/danburkert/prost#278e8ab695f4acb415ab6f780a5c85f0a1a3b0ec" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "prost-derive", ] [[package]] name = "prost-build" version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b10678c913ecbd69350e8535c3aef91a8676c0773fc1d7b95cdd196d7f2f26" +source = "git+https://github.com/danburkert/prost#278e8ab695f4acb415ab6f780a5c85f0a1a3b0ec" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "heck", "itertools", "log", @@ -2034,8 +2020,7 @@ dependencies = [ [[package]] name = "prost-derive" version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" +source = "git+https://github.com/danburkert/prost#278e8ab695f4acb415ab6f780a5c85f0a1a3b0ec" dependencies = [ "anyhow", "itertools", @@ -2047,10 +2032,9 @@ dependencies = [ [[package]] name = "prost-types" version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1834f67c0697c001304b75be76f67add9c89742eda3a085ad8ee0bb38c3417aa" +source = "git+https://github.com/danburkert/prost#278e8ab695f4acb415ab6f780a5c85f0a1a3b0ec" dependencies = [ - "bytes 0.5.4", + "bytes 0.6.0", "prost", ] @@ -2079,6 +2063,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" + [[package]] name = "rand" version = "0.6.5" @@ -2310,9 +2300,9 @@ dependencies = [ [[package]] name = "resolv-conf" -version = "0.6.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11834e137f3b14e309437a8276714eed3a80d1ef894869e510f2c0c0b98b9f4a" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ "hostname", "quick-error", @@ -2333,12 +2323,6 @@ dependencies = [ "winapi 0.3.8", ] -[[package]] -name = "rustc-demangle" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e" - [[package]] name = "rustc_version" version = "0.2.3" @@ -2469,11 +2453,11 @@ checksum = "7acad6f34eb9e8a259d3283d1e8c1d34d7415943d4895f65cc73813c7396fc85" [[package]] name = "socket2" -version = "0.3.12" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +checksum = "2c29947abdee2a218277abeca306f25789c938e500ea5a9d4b12a5a504466902" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", "redox_syscall", "winapi 0.3.8", @@ -2491,15 +2475,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "string" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0bbfb8937e38e34c3444ff00afb28b0811d9554f15c5ad64d12b0308d1d1995" -dependencies = [ - "bytes 0.4.11", -] - [[package]] name = "syn" version = "1.0.48" @@ -2511,6 +2486,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "tap" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36474e732d1affd3a6ed582781b3683df3d0563714c59c39591e8ff707cf078e" + [[package]] name = "tempfile" version = "3.0.5" @@ -2527,18 +2508,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.18" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5976891d6950b4f68477850b5b9e5aa64d955961466f9e174363f573e54e8ca7" +checksum = "0e9ae34b84616eedaaf1e9dd6026dbe00dcafa92aa0c8077cb69df1fcfe5e53e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.18" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab81dbd1cd69cd2ce22ecfbdd3bdb73334ba25350649408cc6c085f46d89573d" +checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56" dependencies = [ "proc-macro2", "quote", @@ -2593,21 +2574,11 @@ dependencies = [ "bytes 0.5.4", "fnv", "futures-core", - "iovec", - "lazy_static", - "libc", "memchr 2.3.3", - "mio", - "mio-named-pipes", - "mio-uds", - "num_cpus", - "parking_lot", "pin-project-lite 0.1.4", - "signal-hook-registry", "slab", "tokio-macros 0.2.6", "tracing", - "winapi 0.3.8", ] [[package]] @@ -2617,10 +2588,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a12a3eb39ee2c231be64487f1fcbe726c8f2514876a55480a5ab8559fc374252" dependencies = [ "autocfg 1.0.0", + "bytes 0.6.0", "futures-core", + "lazy_static", + "libc", + "memchr 2.3.3", + "mio", + "num_cpus", + "parking_lot", "pin-project-lite 0.2.0", + "signal-hook-registry", "slab", "tokio-macros 0.3.1", + "winapi 0.3.8", ] [[package]] @@ -2638,7 +2618,7 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" dependencies = [ - "crossbeam-utils", + "crossbeam-utils 0.7.2", "futures 0.1.26", ] @@ -2677,13 +2657,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12831b255bcfa39dc0436b01e19fea231a37db570686c06ee72c423479f889a" +version = "0.20.0" +source = "git+https://github.com/tokio-rs/tls?rev=e6ef54641b911cfcf23b77a8c4826ae0f8e9870e#e6ef54641b911cfcf23b77a8c4826ae0f8e9870e" dependencies = [ - "futures-core", "rustls", - "tokio 0.2.23", + "tokio 0.3.5", "webpki", ] @@ -2715,7 +2693,7 @@ version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" dependencies = [ - "crossbeam-utils", + "crossbeam-utils 0.7.2", "futures 0.1.26", "slab", "tokio-executor", @@ -2741,33 +2719,45 @@ checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" dependencies = [ "bytes 0.5.4", "futures-core", - "futures-io", "futures-sink", "log", "pin-project-lite 0.1.4", "tokio 0.2.23", ] +[[package]] +name = "tokio-util" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3137de2b078e95274b696cc522e87f22c9a753fe3ef3344116ffb94f104f10a3" +dependencies = [ + "bytes 0.6.0", + "futures-core", + "futures-io", + "futures-sink", + "log", + "pin-project-lite 0.2.0", + "tokio 0.3.5", +] + [[package]] name = "tonic" version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74a5d6e7439ecf910463667080de772a9c7ddf26bc9fb4f3252ac3862e43337d" +source = "git+https://github.com/hawkw/tonic?branch=eliza/tokio-0.3#30526bc9dfd4c02cce48ac92804204fd9178cb59" dependencies = [ - "async-stream", + "async-stream 0.2.1", "async-trait", "base64 0.12.3", - "bytes 0.5.4", + "bytes 0.6.0", "futures-core", "futures-util", - "http 0.2.1", + "http", "http-body", "percent-encoding", - "pin-project", + "pin-project 0.4.22", "prost", "prost-derive", - "tokio-util", - "tower-make", + "tokio-util 0.5.1", "tower-service", "tracing", ] @@ -2775,8 +2765,7 @@ dependencies = [ [[package]] name = "tonic-build" version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19970cf58f3acc820962be74c4021b8bbc8e8a1c4e3a02095d0aa60cde5f3633" +source = "git+https://github.com/hawkw/tonic?branch=eliza/tokio-0.3#30526bc9dfd4c02cce48ac92804204fd9178cb59" dependencies = [ "proc-macro2", "prost-build", @@ -2786,17 +2775,17 @@ dependencies = [ [[package]] name = "tower" -version = "0.3.1" -source = "git+https://github.com/tower-rs/tower?rev=ad348d8#ad348d8ee5106f21b87155d2a0e8e18b90bd6b73" +version = "0.4.0" +source = "git+https://github.com/tower-rs/tower?rev=450fa3d2be2b43850ceb125009d636d1d8629ad7#450fa3d2be2b43850ceb125009d636d1d8629ad7" dependencies = [ "futures-core", "futures-util", "indexmap", - "pin-project", + "pin-project 1.0.2", "rand 0.7.2", "slab", - "tokio 0.2.23", - "tower-layer 0.3.0 (git+https://github.com/tower-rs/tower?rev=ad348d8)", + "tokio 0.3.5", + "tower-layer 0.3.0 (git+https://github.com/tower-rs/tower?rev=450fa3d2be2b43850ceb125009d636d1d8629ad7)", "tower-service", "tracing", ] @@ -2810,24 +2799,14 @@ checksum = "a35d656f2638b288b33495d1053ea74c40dc05ec0b92084dd71ca5566c4ed1dc" [[package]] name = "tower-layer" version = "0.3.0" -source = "git+https://github.com/tower-rs/tower?rev=ad348d8#ad348d8ee5106f21b87155d2a0e8e18b90bd6b73" - -[[package]] -name = "tower-make" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce50370d644a0364bf4877ffd4f76404156a248d104e2cc234cd391ea5cdc965" -dependencies = [ - "tokio 0.2.23", - "tower-service", -] +source = "git+https://github.com/tower-rs/tower?rev=450fa3d2be2b43850ceb125009d636d1d8629ad7#450fa3d2be2b43850ceb125009d636d1d8629ad7" [[package]] name = "tower-request-modifier" version = "0.1.0" -source = "git+https://github.com/tower-rs/tower-http#bd7a4654bdc4e2b5363572e9f66b4dbbc7c0e1ea" +source = "git+https://github.com/tower-rs/tower-http?rev=bd7a4654bdc4e2b5363572e9f66b4dbbc7c0e1ea#bd7a4654bdc4e2b5363572e9f66b4dbbc7c0e1ea" dependencies = [ - "http 0.2.1", + "http", "tower-service", ] @@ -2844,7 +2823,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ba4bbc2c1e4a8543c30d4c13a4c8314ed72d6e07581910f665aa13fde0153c8" dependencies = [ "futures-util", - "pin-project", + "pin-project 0.4.22", "tokio 0.2.23", "tokio-test 0.2.1", "tower-layer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2853,12 +2832,13 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.19" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c" +checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "log", + "pin-project-lite 0.2.0", "tracing-attributes", "tracing-core", ] @@ -2889,7 +2869,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" dependencies = [ - "pin-project", + "pin-project 0.4.22", "tracing", ] @@ -2939,41 +2919,43 @@ dependencies = [ [[package]] name = "trust-dns-proto" -version = "0.20.0" -source = "git+https://github.com/bluejekyll/trust-dns.git?rev=97d3bf10ecb0711aebf523e930f5de873808eb33#97d3bf10ecb0711aebf523e930f5de873808eb33" +version = "0.20.0-alpha.3" +source = "git+https://github.com/bluejekyll/trust-dns?rev=028ac68ee016c1b5d92366ee5fe6661f6132de4d#028ac68ee016c1b5d92366ee5fe6661f6132de4d" dependencies = [ "async-trait", - "backtrace", + "cfg-if 1.0.0", + "data-encoding", "enum-as-inner", "futures-channel", "futures-io", "futures-util", "idna", + "ipnet 2.3.0", "lazy_static", "log", "rand 0.7.2", "smallvec", "thiserror", - "tokio 0.2.23", + "tokio 0.3.5", "url", ] [[package]] name = "trust-dns-resolver" -version = "0.20.0" -source = "git+https://github.com/bluejekyll/trust-dns.git?rev=97d3bf10ecb0711aebf523e930f5de873808eb33#97d3bf10ecb0711aebf523e930f5de873808eb33" +version = "0.20.0-alpha.3" +source = "git+https://github.com/bluejekyll/trust-dns?rev=028ac68ee016c1b5d92366ee5fe6661f6132de4d#028ac68ee016c1b5d92366ee5fe6661f6132de4d" dependencies = [ - "backtrace", - "cfg-if 0.1.10", + "cfg-if 1.0.0", "futures-util", "ipconfig", "lazy_static", "log", "lru-cache", + "parking_lot", "resolv-conf", "smallvec", "thiserror", - "tokio 0.2.23", + "tokio 0.3.5", "trust-dns-proto", ] @@ -3142,11 +3124,12 @@ dependencies = [ [[package]] name = "which" -version = "3.1.1" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" +checksum = "87c14ef7e1b8b8ecfc75d5eca37949410046e66f15d185c01d70824f1f8111ef" dependencies = [ "libc", + "thiserror", ] [[package]] @@ -3199,11 +3182,7 @@ dependencies = [ ] [[package]] -name = "ws2_32-sys" -version = "0.2.1" +name = "wyz" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] +checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" diff --git a/Cargo.toml b/Cargo.toml index 17c7d2d405..473bf1ef64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,4 +63,19 @@ debug = false [patch.crates-io] webpki = { git = "https://github.com/linkerd/webpki", branch = "cert-dns-names-0.21", rev = "b2c3bb3" } -tower = { version = "0.3", git = "https://github.com/tower-rs/tower", rev = "ad348d8" } +# TODO(eliza): when the Tokio 0.3 versions of our various dependencies are +# published, remove these patches... +tower = { version = "0.4", git = "https://github.com/tower-rs/tower", rev = "450fa3d2be2b43850ceb125009d636d1d8629ad7" } +hyper = { git = "https://github.com/hyperium/hyper", rev = "d6aadb830072959497f414c01bcdba4c8e681088" } +# this isn't pinned to a rev because it needs to be consistent with Hyper's git +# dep (which is not pinned). +h2 = { git = "https://github.com/hyperium/h2" } +# this isn't pinned to a rev because it needs to be consistent with Hyper's git +# dep (which is `branch = "master"`). +http-body = { git = "https://github.com/hyperium/http-body", branch = "master" } +tokio-rustls = { git = "https://github.com/tokio-rs/tls", rev = "e6ef54641b911cfcf23b77a8c4826ae0f8e9870e" } +tonic = { git = "https://github.com/hawkw/tonic", branch = "eliza/tokio-0.3" } +tonic-build = { git = "https://github.com/hawkw/tonic", branch = "eliza/tokio-0.3" } +prost = { git = "https://github.com/danburkert/prost" } +prost-build = { git = "https://github.com/danburkert/prost" } +prost-types = { git = "https://github.com/danburkert/prost" } \ No newline at end of file diff --git a/hyper-balance/Cargo.toml b/hyper-balance/Cargo.toml index 73ecce128c..f0c30bb654 100644 --- a/hyper-balance/Cargo.toml +++ b/hyper-balance/Cargo.toml @@ -8,10 +8,10 @@ publish = false [dependencies] futures = "0.3" http = "0.2" -hyper = "0.13.7" +hyper = "0.14.0-dev" pin-project = "0.4" -tower = { version = "0.3", default-features = false, features = ["load"]} -tokio = { version = "0.2", features = ["macros"]} +tower = { version = "0.4", default-features = false, features = ["load"]} +tokio = { version = "0.3", features = ["macros"]} [dev-dependencies] tokio-test = "0.2" \ No newline at end of file diff --git a/linkerd/app/Cargo.toml b/linkerd/app/Cargo.toml index f0a7143b64..e37ecaf5ef 100644 --- a/linkerd/app/Cargo.toml +++ b/linkerd/app/Cargo.toml @@ -24,8 +24,8 @@ linkerd2-app-outbound = { path = "./outbound" } linkerd2-opencensus = { path = "../opencensus" } linkerd2-error = { path = "../error" } regex = "1.0.0" -tokio = { version = "0.2", features = ["rt-util"] } -tonic = { version = "0.3", default-features = false } -tower = "0.3" -tracing = "0.1.19" -tracing-futures = { version = "0.2", features = ["std-future"]} +tokio = { version = "0.3", features = ["rt"] } +tonic = { version = "0.3", default-features = false, features = ["prost"] } +tower = "0.4" +tracing = "0.1.22" +tracing-futures = { version = "0.2", features = ["std-future"]} \ No newline at end of file diff --git a/linkerd/app/core/Cargo.toml b/linkerd/app/core/Cargo.toml index caa7f7b9a2..6a21d67bc0 100644 --- a/linkerd/app/core/Cargo.toml +++ b/linkerd/app/core/Cargo.toml @@ -15,10 +15,10 @@ independently of the inbound and outbound proxy logic. mock-orig-dst = ["linkerd2-proxy-transport/mock-orig-dst"] [dependencies] -bytes = "0.5" +bytes = "0.6" http = "0.2" -http-body = "0.3" -hyper = "0.13.7" +http-body = "0.4" +hyper = "0.14.0-dev" futures = "0.3" indexmap = "1.0" ipnet = "1.0" @@ -40,7 +40,7 @@ linkerd2-http-metrics = { path = "../../http-metrics" } linkerd2-metrics = { path = "../../metrics" } linkerd2-opencensus = { path = "../../opencensus" } linkerd2-proxy-core = { path = "../../proxy/core" } -linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", tag = "v0.1.15" } +linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", rev = "259628840ba613c2e5673fc6a39b946e1b06f09a" } linkerd2-proxy-api-resolve = { path = "../../proxy/api-resolve" } linkerd2-proxy-discover = { path = "../../proxy/discover" } linkerd2-proxy-identity = { path = "../../proxy/identity" } @@ -60,16 +60,16 @@ linkerd2-stack-metrics = { path = "../../stack/metrics" } linkerd2-stack-tracing = { path = "../../stack/tracing" } linkerd2-trace-context = { path = "../../trace-context" } regex = "1.0.0" -tokio = { version = "0.2.22", features = ["macros", "sync", "parking_lot"]} +tokio = { version = "0.3", features = ["macros", "sync", "parking_lot"]} tokio-timer = "0.2" -tower-request-modifier = { git = "https://github.com/tower-rs/tower-http" } +tower-request-modifier = { git = "https://github.com/tower-rs/tower-http", rev = "bd7a4654bdc4e2b5363572e9f66b4dbbc7c0e1ea" } tonic = { version = "0.3", default-features = false, features = ["prost"] } -tracing = "0.1.19" +tracing = "0.1.22" tracing-futures = { version = "0.2" } pin-project = "0.4" [dependencies.tower] -version = "0.3" +version = "0.4" # disable tower's tracing `log` integration for performance reasons, since we # will consume tower's traces as traces. default-features = false @@ -85,5 +85,5 @@ libc = "0.2" procinfo = "0.4.2" [dev-dependencies] -linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", tag = "v0.1.15", features = ["arbitrary"] } +linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", rev = "259628840ba613c2e5673fc6a39b946e1b06f09a", features = ["arbitrary"] } prost-types = "0.6.0" diff --git a/linkerd/app/core/src/control.rs b/linkerd/app/core/src/control.rs index 592b412245..62d195d197 100644 --- a/linkerd/app/core/src/control.rs +++ b/linkerd/app/core/src/control.rs @@ -34,7 +34,7 @@ impl fmt::Display for ControlAddr { } type BalanceBody = - http::balance::PendingUntilFirstDataBody; + http::balance::PendingUntilFirstDataBody; type RspBody = linkerd2_http_metrics::requests::ResponseBody; diff --git a/linkerd/app/gateway/Cargo.toml b/linkerd/app/gateway/Cargo.toml index a494201c24..501193b7cc 100644 --- a/linkerd/app/gateway/Cargo.toml +++ b/linkerd/app/gateway/Cargo.toml @@ -12,11 +12,12 @@ indexmap = "1.0" linkerd2-app-core = { path = "../core" } linkerd2-app-inbound = { path = "../inbound" } linkerd2-app-outbound = { path = "../outbound" } -tower = { version = "0.3", default-features = false } -tracing = "0.1.19" +tower = { version = "0.4", default-features = false } +tracing = "0.1.22" [dev-dependencies] -tokio = { version = "0.2", features = ["rt-core", "macros"] } +tokio = { version = "0.3", features = ["rt", "macros"] } tokio-test = "0.2" -tower = { version = "0.3", default-features = false, features = ["util"] } +tower = { version = "0.4", default-features = false, features = ["util"] } tower-test = "0.3" +linkerd2-app-test = { path = "../test" } \ No newline at end of file diff --git a/linkerd/app/gateway/src/lib.rs b/linkerd/app/gateway/src/lib.rs index b0698cac9c..5d381f1077 100644 --- a/linkerd/app/gateway/src/lib.rs +++ b/linkerd/app/gateway/src/lib.rs @@ -19,6 +19,7 @@ mod test { Error, NameAddr, NameMatch, Never, }; use linkerd2_app_inbound::endpoint as inbound; + use linkerd2_app_test as support; use std::{net::SocketAddr, str::FromStr}; use tower::util::{service_fn, ServiceExt}; use tower_test::mock; @@ -133,11 +134,10 @@ mod test { >(); let mut make_gateway = { let profiles = service_fn(move |na: NameAddr| async move { - let (mut tx, rx) = tokio::sync::watch::channel(profiles::Profile { + let rx = support::profile::only(profiles::Profile { name: Some(na.name().clone()), ..profiles::Profile::default() }); - tokio::spawn(async move { tx.closed().await }); Ok::<_, Never>(Some(rx)) }); let allow_discovery = NameMatch::new(Some(dns::Suffix::from_str(suffix).unwrap())); diff --git a/linkerd/app/inbound/Cargo.toml b/linkerd/app/inbound/Cargo.toml index b8dd6ac19d..01479987e4 100644 --- a/linkerd/app/inbound/Cargo.toml +++ b/linkerd/app/inbound/Cargo.toml @@ -9,16 +9,16 @@ Configures and runs the inbound proxy """ [dependencies] -bytes = "0.5" +bytes = "0.6" http = "0.2" futures = { version = "0.3" } indexmap = "1.0" linkerd2-app-core = { path = "../core" } -tokio = { version = "0.2", features = ["sync"] } -tracing = "0.1.19" +tokio = { version = "0.3", features = ["sync"] } +tracing = "0.1.22" [dependencies.tower] -version = "0.3" +version = "0.4" # disable tower's tracing `log` integration for performance reasons, since we # will consume tower's traces as traces. default-features = false diff --git a/linkerd/app/integration/Cargo.toml b/linkerd/app/integration/Cargo.toml index f6556bed23..d9e30028a4 100644 --- a/linkerd/app/integration/Cargo.toml +++ b/linkerd/app/integration/Cargo.toml @@ -18,25 +18,25 @@ flaky_tests = [] nyi = [] [dependencies] -bytes = "0.5" -futures = "0.3" -h2 = "0.2.6" +bytes = "0.6" +futures = "0.3" +h2 = "0.3" http = "0.2" -http-body = "0.3" -hyper = "0.13.7" +http-body = "0.4" +hyper = "0.14.0-dev" linkerd2-app = { path = "..", features = ["mock-orig-dst"] } linkerd2-app-core = { path = "../core", features = ["mock-orig-dst"] } linkerd2-metrics = { path = "../../metrics", features = ["test_util"] } -linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", tag = "v0.1.15", features = ["arbitrary"] } +linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", rev = "259628840ba613c2e5673fc6a39b946e1b06f09a", features = ["arbitrary"] } linkerd2-app-test = { path = "../test" } regex = "0.1" socket2 = "0.3.12" rustls = "0.18" -tokio = { version = "0.2", features = ["io-util", "net", "rt-core"]} -tokio-rustls = "0.14.1" -tower = { version = "0.3", default-features = false} +tokio = { version = "0.3", features = ["io-util", "net", "rt", "macros"]} +tokio-rustls = "0.20" +tower = { version = "0.4", default-features = false} tonic = { version = "0.3", default-features = false } -tracing = "0.1.19" +tracing = "0.1.22" tracing-futures = { version = "0.2", features = ["std-future"] } webpki = "0.21" diff --git a/linkerd/app/integration/src/client.rs b/linkerd/app/integration/src/client.rs index b7917ff2b5..7c81ddaf40 100644 --- a/linkerd/app/integration/src/client.rs +++ b/linkerd/app/integration/src/client.rs @@ -1,4 +1,5 @@ use super::*; +use hyper::body::Buf; use linkerd2_app_core::proxy::http::trace; use rustls::ClientConfig; use std::io; @@ -121,7 +122,7 @@ impl Client { ); let stream = res.into_parts().1; let mut body = hyper::body::aggregate(stream).await.expect("wait body"); - std::str::from_utf8(body.to_bytes().as_ref()) + std::str::from_utf8(body.copy_to_bytes(body.remaining()).as_ref()) .unwrap() .to_string() } diff --git a/linkerd/app/integration/src/controller.rs b/linkerd/app/integration/src/controller.rs index 81858c00e4..92c197fe51 100644 --- a/linkerd/app/integration/src/controller.rs +++ b/linkerd/app/integration/src/controller.rs @@ -362,7 +362,7 @@ where let task = tokio::spawn( cancelable(drain.clone(), async move { // Start listening on the socket. - let mut listener = crate::listen(sock); + let listener = crate::listen(sock); let mut listening_tx = Some(listening_tx); if let Some(delay) = delay { diff --git a/linkerd/app/integration/src/lib.rs b/linkerd/app/integration/src/lib.rs index 5e7594402e..c474fd0733 100644 --- a/linkerd/app/integration/src/lib.rs +++ b/linkerd/app/integration/src/lib.rs @@ -30,7 +30,7 @@ use std::pin::Pin; pub use std::sync::Arc; use std::task::{Context, Poll}; pub use std::time::Duration; -pub use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; +pub use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, ReadBuf}; use tokio::net::TcpListener; pub use tokio::stream::{Stream, StreamExt}; pub use tokio::sync::oneshot; @@ -69,7 +69,7 @@ macro_rules! assert_eventually { use std::{env, u64}; use std::time::{Instant, Duration}; use std::str::FromStr; - use tracing_futures::Instrument as _; + use tracing::Instrument as _; // TODO: don't do this *every* time eventually is called (lazy_static?) let patience = env::var($crate::ENV_TEST_PATIENCE_MS).ok() .map(|s| { @@ -96,7 +96,7 @@ macro_rules! assert_eventually { ) } else { tracing::trace!("waiting..."); - tokio::time::delay_for(patience).await; + tokio::time::sleep(patience).await; std::thread::yield_now(); tracing::trace!("done"); } @@ -165,14 +165,10 @@ impl AsyncRead for RunningIo { fn poll_read( mut self: Pin<&mut Self>, cx: &mut Context<'_>, - buf: &mut [u8], - ) -> Poll> { + buf: &mut ReadBuf<'_>, + ) -> Poll> { self.as_mut().io.as_mut().poll_read(cx, buf) } - - unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [std::mem::MaybeUninit]) -> bool { - self.io.prepare_uninitialized_buffer(buf) - } } impl AsyncWrite for RunningIo { @@ -297,6 +293,8 @@ pub(crate) fn bind_ephemeral() -> (Socket, SocketAddr) { pub(crate) fn listen(sock: Socket) -> TcpListener { sock.listen(1024) .expect("socket should be able to start listening"); - TcpListener::from_std(sock.into_tcp_listener()) - .expect("socket should be able to set nonblocking") + let sock = sock.into_tcp_listener(); + sock.set_nonblocking(true) + .expect("socket should be able to set nonblocking"); + TcpListener::from_std(sock).expect("socket should seem okay to tokio") } diff --git a/linkerd/app/integration/src/proxy.rs b/linkerd/app/integration/src/proxy.rs index e2927b50a0..f340418a90 100644 --- a/linkerd/app/integration/src/proxy.rs +++ b/linkerd/app/integration/src/proxy.rs @@ -313,9 +313,8 @@ async fn run(proxy: Proxy, mut env: TestEnv, random_ports: bool) -> Listening { let span = info_span!("proxy", test = %thread_name()); let _enter = span.enter(); - tokio::runtime::Builder::new() + tokio::runtime::Builder::new_current_thread() .enable_all() - .basic_scheduler() .build() .expect("proxy") .block_on(async move { diff --git a/linkerd/app/integration/src/server.rs b/linkerd/app/integration/src/server.rs index 0646692606..893ce4a771 100644 --- a/linkerd/app/integration/src/server.rs +++ b/linkerd/app/integration/src/server.rs @@ -169,7 +169,7 @@ impl Server { self.route_async(path, move |_| { let resp = resp.clone(); async move { - tokio::time::delay_for(latency).await; + tokio::time::sleep(latency).await; Ok::<_, BoxError>( http::Response::builder() .status(200) @@ -223,7 +223,7 @@ impl Server { } // After the delay, start listening on the socket. - let mut listener = crate::listen(sock); + let listener = crate::listen(sock); if let Some(listening_tx) = listening_tx { let _ = listening_tx.send(()); diff --git a/linkerd/app/integration/src/tcp.rs b/linkerd/app/integration/src/tcp.rs index 2f17e5572e..1c3b77319d 100644 --- a/linkerd/app/integration/src/tcp.rs +++ b/linkerd/app/integration/src/tcp.rs @@ -212,7 +212,10 @@ async fn run_server(tcp: TcpServer) -> server::Listening { let task = tokio::spawn( cancelable(drain.clone(), async move { let mut accepts = tcp.accepts; - let mut listener = TcpListener::from_std(std_listener).expect("TcpListener::from_std"); + std_listener + .set_nonblocking(true) + .expect("socket must be able to set nonblocking"); + let listener = TcpListener::from_std(std_listener).expect("TcpListener::from_std"); let _ = started_tx.send(()); loop { diff --git a/linkerd/app/integration/src/tests/discovery.rs b/linkerd/app/integration/src/tests/discovery.rs index 2205acd394..b3d99b7724 100644 --- a/linkerd/app/integration/src/tests/discovery.rs +++ b/linkerd/app/integration/src/tests/discovery.rs @@ -213,12 +213,13 @@ macro_rules! generate_tests { .await } - #[tokio::test] + #[tokio::test(flavor = "current_thread")] async fn outbound_destinations_reset_on_reconnect_followed_by_dne() { outbound_destinations_reset_on_reconnect(controller::destination_does_not_exist()).await } async fn outbound_destinations_reset_on_reconnect(up: pb::destination::Update) { + let _trace = trace_init(); let env = TestEnv::new(); let srv = $make_server().route("/", "hello").run().await; let ctrl = controller::new(); @@ -250,7 +251,7 @@ macro_rules! generate_tests { dst_tx1.send(up); // Wait for the reconnect to happen. TODO: Replace this flaky logic. - tokio::time::delay_for(Duration::from_millis(1000)).await; + tokio::time::sleep(Duration::from_millis(1000)).await; let rsp = initially_exists .request(initially_exists.request_builder("/")) @@ -320,12 +321,12 @@ macro_rules! generate_tests { .await; // Allow the control client to notice a connection error - tokio::time::delay_for(Duration::from_millis(500)).await; + tokio::time::sleep(Duration::from_millis(500)).await; // Allow our controller to start accepting connections, // and then wait a little bit so the client tries again. drop(tx); - tokio::time::delay_for(Duration::from_millis(500)).await; + tokio::time::sleep(Duration::from_millis(500)).await; let client = $make_client(proxy.outbound, "disco.test.svc.cluster.local"); diff --git a/linkerd/app/integration/src/tests/identity.rs b/linkerd/app/integration/src/tests/identity.rs index 478d82b38b..bbcc72dd9b 100644 --- a/linkerd/app/integration/src/tests/identity.rs +++ b/linkerd/app/integration/src/tests/identity.rs @@ -232,7 +232,7 @@ async fn refresh() { let expiry = expiry_rx.await.expect("wait for expiry"); let how_long = expiry.duration_since(SystemTime::now()).unwrap(); - tokio::time::delay_for(how_long).await; + tokio::time::sleep(how_long).await; assert_eventually!(refreshed.load(Ordering::SeqCst) == true); } diff --git a/linkerd/app/integration/src/tests/profile_dst_overrides.rs b/linkerd/app/integration/src/tests/profile_dst_overrides.rs index 1dc9305e81..542eb498af 100644 --- a/linkerd/app/integration/src/tests/profile_dst_overrides.rs +++ b/linkerd/app/integration/src/tests/profile_dst_overrides.rs @@ -61,7 +61,7 @@ async fn wait_for_profile_stage(client: &client::Client, metrics: &client::Clien break; } - tokio::time::delay_for(std::time::Duration::from_millis(200)).await; + tokio::time::sleep(std::time::Duration::from_millis(200)).await; } } diff --git a/linkerd/app/integration/src/tests/profiles.rs b/linkerd/app/integration/src/tests/profiles.rs index 7329e07fb9..90d3760bf2 100644 --- a/linkerd/app/integration/src/tests/profiles.rs +++ b/linkerd/app/integration/src/tests/profiles.rs @@ -122,7 +122,7 @@ macro_rules! profile_test { break; } - tokio::time::delay_for(std::time::Duration::from_millis(200)).await; + tokio::time::sleep(std::time::Duration::from_millis(200)).await; } $with_client(client).await; diff --git a/linkerd/app/integration/src/tests/shutdown.rs b/linkerd/app/integration/src/tests/shutdown.rs index c951fa92f5..dfa4c3b0fa 100644 --- a/linkerd/app/integration/src/tests/shutdown.rs +++ b/linkerd/app/integration/src/tests/shutdown.rs @@ -52,7 +52,7 @@ async fn h2_exercise_goaways_connections() { .map(|resp| { hyper::body::aggregate(resp.into_body()) // Make sure the bodies weren't cut off - .map_ok(|mut buf| assert_eq!(buf.to_bytes().len(), RESPONSE_SIZE)) + .map_ok(|buf| assert_eq!(buf.remaining(), RESPONSE_SIZE)) }) .collect::>(); diff --git a/linkerd/app/integration/src/tests/telemetry.rs b/linkerd/app/integration/src/tests/telemetry.rs index 7c7550ea5e..b9901cee6b 100644 --- a/linkerd/app/integration/src/tests/telemetry.rs +++ b/linkerd/app/integration/src/tests/telemetry.rs @@ -1494,7 +1494,9 @@ async fn metrics_compression() { let mut body = hyper::body::aggregate(resp.into_body()) .await .expect("response body concat"); - let mut decoder = flate2::read::GzDecoder::new(std::io::Cursor::new(body.to_bytes())); + let mut decoder = flate2::read::GzDecoder::new(std::io::Cursor::new( + body.copy_to_bytes(body.remaining()), + )); let mut scrape = String::new(); decoder.read_to_string(&mut scrape).expect(&format!( "decode gzip (requested Accept-Encoding: {})", diff --git a/linkerd/app/integration/src/tests/transparency.rs b/linkerd/app/integration/src/tests/transparency.rs index 425c9da678..de229d8499 100644 --- a/linkerd/app/integration/src/tests/transparency.rs +++ b/linkerd/app/integration/src/tests/transparency.rs @@ -203,7 +203,7 @@ async fn test_server_speaks_first(env: TestEnv) { let msg1 = "custom tcp server starts"; let msg2 = "custom tcp client second"; - let (mut tx, mut rx) = mpsc::channel(1); + let (tx, mut rx) = mpsc::channel(1); let srv = server::tcp() .accept_fut(move |mut sock| { async move { @@ -813,8 +813,8 @@ macro_rules! http1_tests { assert_eq!(req.headers()["transfer-encoding"], "chunked"); let body = req .into_body() - .fold(String::new(), |s, mut chunk| { - s + std::str::from_utf8(chunk.to_bytes().as_ref()).expect("req is utf8") + .fold(String::new(), |s, chunk| { + s + std::str::from_utf8(chunk.bytes()).expect("req is utf8") }) .await; assert_eq!(body, "hello"); @@ -841,10 +841,10 @@ macro_rules! http1_tests { assert_eq!(resp.status(), StatusCode::OK); assert_eq!(resp.headers()["transfer-encoding"], "chunked"); - let mut body = hyper::body::aggregate(resp.into_body()) + let body = hyper::body::aggregate(resp.into_body()) .await .expect("rsp aggregate"); - let body = std::str::from_utf8(body.to_bytes().as_ref()) + let body = std::str::from_utf8(body.bytes()) .expect("rsp is utf8") .to_owned(); assert_eq!(body, "world"); @@ -1027,10 +1027,10 @@ macro_rules! http1_tests { assert_eq!(resp.status(), StatusCode::OK); assert_eq!(resp.headers()["content-length"], "55"); - let mut body = hyper::body::aggregate(resp.into_body()) + let body = hyper::body::aggregate(resp.into_body()) .await .expect("response body aggregate"); - let body = std::str::from_utf8(body.to_bytes().as_ref()) + let body = std::str::from_utf8(body.bytes()) .expect("empty body is utf8") .to_owned(); @@ -1097,10 +1097,10 @@ macro_rules! http1_tests { v ); - let mut body = hyper::body::aggregate(resp.into_body()) + let body = hyper::body::aggregate(resp.into_body()) .await .expect("aggregate response body"); - let body = std::str::from_utf8(body.to_bytes().as_ref()) + let body = std::str::from_utf8(body.bytes()) .expect("body is utf8") .to_owned(); @@ -1145,8 +1145,6 @@ mod proxy_to_proxy { } http1_tests! { proxy: |srv: server::Listening| async move { - use tracing_futures::Instrument; - let ctrl = controller::new(); let srv_addr = srv.addr; let _profile_in = ctrl.profile_tx_default(srv_addr, "transparency.test.svc.cluster.local"); @@ -1373,7 +1371,7 @@ async fn retry_reconnect_errors() { drop(tx); // start `listen` now // This may be flaky on CI. - tokio::time::delay_for(std::time::Duration::from_millis(100)).await; + tokio::time::sleep(std::time::Duration::from_millis(100)).await; let res = fut.await.expect("response"); assert_eq!(res.status(), http::StatusCode::OK); diff --git a/linkerd/app/outbound/Cargo.toml b/linkerd/app/outbound/Cargo.toml index 2a5b9d5781..0f4339696f 100644 --- a/linkerd/app/outbound/Cargo.toml +++ b/linkerd/app/outbound/Cargo.toml @@ -9,19 +9,19 @@ Configures and runs the outbound proxy """ [dependencies] -bytes = "0.5" +bytes = "0.6" http = "0.2" futures = "0.3" indexmap = "1.0" linkerd2-app-core = { path = "../core" } linkerd2-identity = { path = "../../identity" } linkerd2-retry = { path = "../../retry" } -tokio = { version = "0.2", features = ["sync"]} -tracing = "0.1.19" +tokio = { version = "0.3", features = ["sync"]} +tracing = "0.1.22" pin-project = "0.4" [dependencies.tower] -version = "0.3" +version = "0.4" # disable tower's tracing `log` integration for performance reasons, since we # will consume tower's traces as traces. default-features = false @@ -30,9 +30,9 @@ features = [ ] [dev-dependencies] -hyper = "0.13" +hyper = "0.14.0-dev" ipnet = "1.0" linkerd2-app-test = { path = "../test" } linkerd2-io = { path = "../../io", features = ["tokio-test"] } -tokio = { version = "0.2", features = ["full", "macros"]} +tokio = { version = "0.3", features = ["full", "macros"]} tracing-futures = "0.2" diff --git a/linkerd/app/outbound/src/http/tests.rs b/linkerd/app/outbound/src/http/tests.rs index 26bd43ddbd..8419f1ec26 100644 --- a/linkerd/app/outbound/src/http/tests.rs +++ b/linkerd/app/outbound/src/http/tests.rs @@ -66,7 +66,7 @@ where (svc, drain_tx) } -#[tokio::test(core_threads = 1)] +#[tokio::test(flavor = "current_thread")] async fn profile_endpoint_propagates_conn_errors() { // This test asserts that when profile resolution returns an endpoint, and // connecting to that endpoint fails, the client connection will also be reset. @@ -101,7 +101,7 @@ async fn profile_endpoint_propagates_conn_errors() { let profiles = profile::resolver(); let profile_tx = profiles.profile_tx(ep1); profile_tx - .broadcast(profile::Profile { + .send(profile::Profile { opaque_protocol: false, endpoint: Some((ep1, meta.clone())), ..Default::default() @@ -146,7 +146,7 @@ async fn profile_endpoint_propagates_conn_errors() { assert_eq!(rsp.status(), http::StatusCode::BAD_GATEWAY); tokio::select! { - _ = time::delay_for(time::Duration::from_secs(10)) => { + _ = time::sleep(time::Duration::from_secs(10)) => { panic!("timeout"); } res = &mut client_task => { diff --git a/linkerd/app/outbound/src/tcp/tests.rs b/linkerd/app/outbound/src/tcp/tests.rs index 0734a05ea4..78bfb2469d 100644 --- a/linkerd/app/outbound/src/tcp/tests.rs +++ b/linkerd/app/outbound/src/tcp/tests.rs @@ -27,7 +27,7 @@ use tls::HasPeerIdentity; use tower::ServiceExt; use tracing_futures::Instrument; -#[tokio::test(core_threads = 1)] +#[tokio::test] async fn plaintext_tcp() { let _trace = support::trace_init(); @@ -39,7 +39,7 @@ async fn plaintext_tcp() { let concrete = Concrete { logical: Logical { orig_dst: target_addr, - profile: Some(default_profile()), + profile: Some(profile::only_default()), protocol: (), }, resolve: Some(target_addr.into()), @@ -78,7 +78,7 @@ async fn plaintext_tcp() { .expect("conn should succeed"); } -#[tokio::test(core_threads = 1)] +#[tokio::test] async fn tls_when_hinted() { let _trace = support::trace_init(); @@ -86,7 +86,7 @@ async fn tls_when_hinted() { let tls_concrete = Concrete { logical: Logical { orig_dst: tls_addr, - profile: Some(default_profile()), + profile: Some(profile::only_default()), protocol: (), }, resolve: Some(tls_addr.into()), @@ -96,7 +96,7 @@ async fn tls_when_hinted() { let plain_concrete = Concrete { logical: Logical { orig_dst: tls_addr, - profile: Some(default_profile()), + profile: Some(profile::only_default()), protocol: (), }, resolve: Some(plain_addr.into()), @@ -335,7 +335,7 @@ async fn load_balances() { ); } -#[tokio::test(core_threads = 1)] +#[tokio::test] async fn load_balancer_add_endpoints() { let _trace = support::trace_init(); @@ -643,7 +643,7 @@ async fn no_profiles_when_outside_search_nets() { ); } -#[tokio::test(core_threads = 1)] +#[tokio::test(flavor = "current_thread")] async fn no_discovery_when_profile_has_an_endpoint() { let _trace = support::trace_init(); @@ -692,7 +692,7 @@ async fn no_discovery_when_profile_has_an_endpoint() { ); } -#[tokio::test(core_threads = 1)] +#[tokio::test(flavor = "current_thread")] async fn profile_endpoint_propagates_conn_errors() { // This test asserts that when profile resolution returns an endpoint, and // connecting to that endpoint fails, the proxy will resolve a new endpoint @@ -733,7 +733,7 @@ async fn profile_endpoint_propagates_conn_errors() { let profiles = profile::resolver(); let profile_tx = profiles.profile_tx(ep1); profile_tx - .broadcast(profile::Profile { + .send(profile::Profile { opaque_protocol: true, endpoint: Some((ep1, meta.clone())), ..Default::default() @@ -752,7 +752,14 @@ async fn profile_endpoint_propagates_conn_errors() { )); let res = svc - .oneshot(support::io().read(b"hello\r\n").write(b"world").build()) + .oneshot( + support::io() + .read_error(io::Error::new( + io::ErrorKind::ConnectionReset, + "i dont like you, go away", + )) + .build(), + ) .await .map_err(Into::into); tracing::info!(?res); diff --git a/linkerd/app/outbound/src/test_util.rs b/linkerd/app/outbound/src/test_util.rs index 7a53dccebe..67486ed5f1 100644 --- a/linkerd/app/outbound/src/test_util.rs +++ b/linkerd/app/outbound/src/test_util.rs @@ -2,7 +2,7 @@ use crate::Config; pub use futures::prelude::*; pub use ipnet::IpNet; use linkerd2_app_core::{ - config, exp_backoff, profiles, + config, exp_backoff, proxy::http::{h1, h2}, transport::listen, IpMatch, @@ -12,12 +12,6 @@ use std::{net::SocketAddr, str::FromStr, time::Duration}; const LOCALHOST: [u8; 4] = [127, 0, 0, 1]; -pub fn default_profile() -> profiles::Receiver { - let (mut tx, rx) = tokio::sync::watch::channel(profiles::Profile::default()); - tokio::spawn(async move { tx.closed().await }); - rx -} - pub fn default_config(orig_dst: SocketAddr) -> Config { Config { allow_discovery: IpMatch::new(Some(IpNet::from_str("0.0.0.0/0").unwrap())).into(), diff --git a/linkerd/app/profiling/Cargo.toml b/linkerd/app/profiling/Cargo.toml index 26e1f754f7..651baa13c8 100644 --- a/linkerd/app/profiling/Cargo.toml +++ b/linkerd/app/profiling/Cargo.toml @@ -13,4 +13,4 @@ for profiling and benchmarking. [dependencies] linkerd2-app-integration = { path = "../integration" } -tokio = { version = "0.2", features = ["rt-core", "net", "macros"]} +tokio = { version = "0.3", features = ["rt", "net", "macros"]} diff --git a/linkerd/app/src/lib.rs b/linkerd/app/src/lib.rs index 859a3ca3a7..cdf5e58287 100644 --- a/linkerd/app/src/lib.rs +++ b/linkerd/app/src/lib.rs @@ -311,8 +311,7 @@ impl App { std::thread::Builder::new() .name("admin".into()) .spawn(move || { - let mut rt = tokio::runtime::Builder::new() - .basic_scheduler() + let rt = tokio::runtime::Builder::new_current_thread() .enable_all() .build() .expect("building admin runtime must succeed"); diff --git a/linkerd/app/test/Cargo.toml b/linkerd/app/test/Cargo.toml index 1be7ffb058..9579be917c 100644 --- a/linkerd/app/test/Cargo.toml +++ b/linkerd/app/test/Cargo.toml @@ -19,16 +19,16 @@ nyi = [] [dependencies] futures = "0.3" -h2 = "0.2.6" +h2 = { git = "https://github.com/hyperium/h2" } http = "0.2" -http-body = "0.3" -hyper = "0.13.7" +http-body = "0.4" +hyper = "0.14.0-dev" linkerd2-app-core = { path = "../core", features = ["mock-orig-dst"] } regex = "0.1" -tokio = { version = "0.2", features = ["io-util", "net", "rt-core"]} -tokio-test = "0.2.1" -tower = { version = "0.3", default-features = false} -tracing = "0.1.19" +tokio = { version = "0.3", features = ["io-util", "net", "rt", "sync"]} +tokio-test = "0.3" +tower = { version = "0.4", default-features = false} +tracing = "0.1.22" tracing-futures = { version = "0.2", features = ["std-future"] } tracing-subscriber = "0.2.11" diff --git a/linkerd/app/test/src/profile.rs b/linkerd/app/test/src/profile.rs index 0039a61519..40c582b207 100644 --- a/linkerd/app/test/src/profile.rs +++ b/linkerd/app/test/src/profile.rs @@ -1,4 +1,22 @@ pub use linkerd2_app_core::{dns, profiles::*}; +pub use tokio::sync::watch; +pub use watch::channel; + +pub type Sender = watch::Sender; + +/// Returns a `Receiver` that contains only the default profile, and closes when +/// the receiver is dropped. +pub fn only_default() -> Receiver { + only(Profile::default()) +} + +/// Returns a `Receiver` that contains only the initial value, and closes when +/// the receiver is dropped. +pub fn only(profile: Profile) -> Receiver { + let (tx, rx) = channel(profile); + tokio::spawn(async move { tx.closed().await }); + rx +} pub fn resolver() -> crate::resolver::Profiles where diff --git a/linkerd/app/test/src/resolver.rs b/linkerd/app/test/src/resolver.rs index 28933552c7..112bb7bbf2 100644 --- a/linkerd/app/test/src/resolver.rs +++ b/linkerd/app/test/src/resolver.rs @@ -1,3 +1,4 @@ +pub use crate::profile::Sender as ProfileSender; use futures::future; pub use linkerd2_app_core::proxy::{ api_resolve::{Metadata, ProtocolHint}, @@ -28,8 +29,6 @@ pub type Profiles = Resolver>; #[derive(Debug, Clone)] pub struct DstSender(mpsc::UnboundedSender, Error>>); -pub type ProfileSender = watch::Sender; - #[derive(Debug, Clone)] pub struct Handle(Arc>); diff --git a/linkerd/buffer/Cargo.toml b/linkerd/buffer/Cargo.toml index 453c3ceff9..52348acede 100644 --- a/linkerd/buffer/Cargo.toml +++ b/linkerd/buffer/Cargo.toml @@ -9,9 +9,9 @@ publish = false futures = "0.3" linkerd2-channel = { path = "../channel" } linkerd2-error = { path = "../error" } -tokio = { version = "0.2", features = ["sync", "stream", "time", "macros"] } -tower = { version = "0.3", default_features = false, features = ["util"] } -tracing = "0.1.19" +tokio = { version = "0.3", features = ["sync", "stream", "time", "macros"] } +tower = { version = "0.4", default_features = false, features = ["util"] } +tracing = "0.1.22" tracing-futures = { version = "0.2", features = ["std-future"] } pin-project = "0.4" diff --git a/linkerd/buffer/src/dispatch.rs b/linkerd/buffer/src/dispatch.rs index 59ab3dd60b..b316d7e9b1 100644 --- a/linkerd/buffer/src/dispatch.rs +++ b/linkerd/buffer/src/dispatch.rs @@ -8,7 +8,7 @@ use tower::util::ServiceExt; use tracing::trace; pub(crate) async fn idle(max: std::time::Duration) -> IdleError { - tokio::time::delay_for(max).await; + tokio::time::sleep(max).await; IdleError(max) } @@ -29,7 +29,7 @@ pub(crate) async fn run( req = requests.recv().fuse() => { match req { None => return, - Some(InFlight { request, tx }) => { + Some(InFlight { request, tx, .. }) => { match service.ready_and().await { Ok(svc) => { trace!("Dispatching request"); @@ -44,7 +44,7 @@ pub(crate) async fn run( while let Some(InFlight { tx, .. }) = requests.recv().await { let _ = tx.send(Err(error.clone().into())); } - return; + break; } }; } @@ -65,7 +65,7 @@ mod test { use super::*; use std::time::Duration; use tokio::sync::oneshot; - use tokio::time::delay_for; + use tokio::time::sleep; use tokio_test::{assert_pending, assert_ready, task}; use tower_test::mock; @@ -81,7 +81,7 @@ mod test { // Service ready without requests. Idle counter starts ticking. assert_pending!(dispatch.poll()); - delay_for(max_idle).await; + sleep(max_idle).await; assert_ready!(dispatch.poll()); drop((tx, handle)); @@ -98,7 +98,7 @@ mod test { // Service ready without requests. Idle counter starts ticking. assert_pending!(dispatch.poll()); - delay_for(max_idle).await; + sleep(max_idle).await; // Send a request after the deadline has fired but before the // dispatch future is polled. Ensure that the request is admitted, @@ -115,7 +115,7 @@ mod test { handle.allow(1); assert_pending!(dispatch.poll()); - delay_for(max_idle).await; + sleep(max_idle).await; assert_ready!(dispatch.poll()); drop((tx, handle)); diff --git a/linkerd/cache/Cargo.toml b/linkerd/cache/Cargo.toml index a36fdac8b3..8afea8ac1c 100644 --- a/linkerd/cache/Cargo.toml +++ b/linkerd/cache/Cargo.toml @@ -11,5 +11,5 @@ linkerd2-error = { path = "../error" } linkerd2-stack = { path = "../stack" } parking_lot = "0.11" tokio = "0.2" -tower = { version = "0.3", default-features = false, features = ["util"] } -tracing = "0.1.19" +tower = { version = "0.4", default-features = false, features = ["util"] } +tracing = "0.1.22" diff --git a/linkerd/concurrency-limit/Cargo.toml b/linkerd/concurrency-limit/Cargo.toml index b198084788..4710a5ba26 100644 --- a/linkerd/concurrency-limit/Cargo.toml +++ b/linkerd/concurrency-limit/Cargo.toml @@ -9,6 +9,6 @@ publish = false [dependencies] futures = "0.3" tokio = { version = "0.2.21", features = ["sync"] } -tower = { version = "0.3", default-features = false } -tracing = "0.1.19" +tower = { version = "0.4", default-features = false } +tracing = "0.1.22" pin-project = "0.4" diff --git a/linkerd/dns/Cargo.toml b/linkerd/dns/Cargo.toml index eadd961217..49492c12ec 100644 --- a/linkerd/dns/Cargo.toml +++ b/linkerd/dns/Cargo.toml @@ -9,14 +9,14 @@ publish = false futures = "0.3" linkerd2-dns-name = { path = "./name" } linkerd2-error = { path = "../error" } -tracing = "0.1.19" -tokio = { version = "0.2", features = ["rt-core", "sync"] } +tracing = "0.1.22" +tokio = { version = "0.3", features = ["rt", "sync"] } pin-project = "0.4" [dependencies.trust-dns-resolver] -version = "0.20" +version = "0.20.0-alpha.3" default-features = false features = ["system-config", "tokio-runtime"] # TODO(eliza): when 0.20 is published, depend on it from crates.io. -git = "https://github.com/bluejekyll/trust-dns.git" -rev = "97d3bf10ecb0711aebf523e930f5de873808eb33" +git = "https://github.com/bluejekyll/trust-dns" +rev = "028ac68ee016c1b5d92366ee5fe6661f6132de4d" \ No newline at end of file diff --git a/linkerd/dns/src/lib.rs b/linkerd/dns/src/lib.rs index 97262dfa25..9ebbc65602 100644 --- a/linkerd/dns/src/lib.rs +++ b/linkerd/dns/src/lib.rs @@ -52,7 +52,9 @@ impl Resolver { pub fn new(config: ResolverConfig, mut opts: ResolverOpts) -> Self { // Disable Trust-DNS's caching. opts.cache_size = 0; - let dns = AsyncResolver::tokio(config, opts).expect("Resolver must be valid"); + // This function is synchronous, but needs to be called within the Tokio + // 0.2 runtime context, since it gets a handle. + let dns = AsyncResolver::tokio(config, opts).expect("system DNS config must be valid"); Resolver { dns } } @@ -62,7 +64,7 @@ impl Resolver { &self, name: &Name, default_port: u16, - ) -> Result<(Vec, time::Delay), Error> { + ) -> Result<(Vec, time::Sleep), Error> { match self.resolve_srv(name).await { Ok(res) => Ok(res), Err(e) if e.is::() => { @@ -80,19 +82,19 @@ impl Resolver { async fn resolve_a( &self, name: &Name, - ) -> Result<(Vec, time::Delay), ResolveError> { + ) -> Result<(Vec, time::Sleep), ResolveError> { debug!(%name, "resolve_a"); match self.dns.lookup_ip(name.as_ref()).await { Ok(lookup) => { let valid_until = Instant::from_std(lookup.valid_until()); let ips = lookup.iter().collect::>(); - Ok((ips, time::delay_until(valid_until))) + Ok((ips, time::sleep_until(valid_until))) } Err(e) => Self::handle_error(e), } } - async fn resolve_srv(&self, name: &Name) -> Result<(Vec, time::Delay), Error> { + async fn resolve_srv(&self, name: &Name) -> Result<(Vec, time::Sleep), Error> { debug!(%name, "resolve_srv"); match self.dns.srv_lookup(name.as_ref()).await { Ok(srv) => { @@ -102,21 +104,22 @@ impl Resolver { .map(Self::srv_to_socket_addr) .collect::>()?; debug!(?addrs); - Ok((addrs, time::delay_until(valid_until))) + Ok((addrs, time::sleep_until(valid_until))) } Err(e) => Self::handle_error(e).map_err(Into::into), } } - fn handle_error(e: ResolveError) -> Result<(Vec, time::Delay), ResolveError> { + fn handle_error(e: ResolveError) -> Result<(Vec, time::Sleep), ResolveError> { match e.kind() { - ResolveErrorKind::NoRecordsFound { valid_until, .. } => { - let expiry = - valid_until.unwrap_or_else(|| std::time::Instant::now() + Self::DEFAULT_TTL); - Ok((vec![], time::delay_until(Instant::from_std(expiry)))) + ResolveErrorKind::NoRecordsFound { negative_ttl, .. } => { + let expiry = negative_ttl + .map(|t| std::time::Duration::from_secs(t as u64)) + .unwrap_or(Self::DEFAULT_TTL); + Ok((vec![], time::sleep(expiry))) } ResolveErrorKind::Proto(pe) if Self::is_nx_domain(&pe) => { - Ok((vec![], time::delay_for(Self::DEFAULT_TTL))) + Ok((vec![], time::sleep(Self::DEFAULT_TTL))) } _ => Err(e), } diff --git a/linkerd/drain/Cargo.toml b/linkerd/drain/Cargo.toml index 9d59fd25fb..e160fab416 100644 --- a/linkerd/drain/Cargo.toml +++ b/linkerd/drain/Cargo.toml @@ -7,9 +7,9 @@ publish = false [dependencies] linkerd2-error = { path = "../error" } -tokio = {version = "0.2.17", features = ["sync", "macros"]} +tokio = {version = "0.3", features = ["sync", "macros", "stream"]} pin-project = "0.4" futures = "0.3" [dev-dependencies] -tokio-test = "0.2" \ No newline at end of file +tokio-test = "0.3" \ No newline at end of file diff --git a/linkerd/drain/src/lib.rs b/linkerd/drain/src/lib.rs index 1ff4612bde..f1e0aa5e8f 100644 --- a/linkerd/drain/src/lib.rs +++ b/linkerd/drain/src/lib.rs @@ -1,28 +1,22 @@ #![deny(warnings, rust_2018_idioms)] - -use futures::{future::Shared, FutureExt}; use linkerd2_error::Never; use pin_project::pin_project; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; -use tokio::sync::{mpsc, oneshot}; +use tokio::{ + stream::Stream, + sync::{mpsc, watch}, +}; /// Creates a drain channel. /// /// The `Signal` is used to start a drain, and the `Watch` will be notified /// when a drain is signaled. pub fn channel() -> (Signal, Watch) { - let (tx, rx) = oneshot::channel(); + let (tx, rx) = watch::channel(()); let (drained_tx, drained_rx) = mpsc::channel(1); - // Since `FutureExt::shared` requires the future's `Output` type to - // implement `Clone`, and `oneshot::RecvError` does not, just map the - // `Output` to `()`. The behavior is the same regardless of whether the - // drain is explicitly signalled or the `Signal` type is thrown away, so - // we don't care whether this is an error or not. - let rx = rx.map((|_| ()) as fn(_) -> _).shared(); - (Signal { drained_rx, tx }, Watch { drained_tx, rx }) } @@ -33,7 +27,7 @@ pub fn channel() -> (Signal, Watch) { #[derive(Debug)] pub struct Signal { drained_rx: mpsc::Receiver, - tx: oneshot::Sender<()>, + tx: watch::Sender<()>, } /// Watch for a drain command. @@ -44,12 +38,7 @@ pub struct Signal { pub struct Watch { #[pin] drained_tx: mpsc::Sender, - rx: Shared< - futures::future::Map< - oneshot::Receiver<()>, - fn(Result<(), tokio::sync::oneshot::error::RecvError>) -> (), - >, - >, + rx: watch::Receiver<()>, } /// A future that resolves when all `Watch`ers have been dropped (drained). @@ -85,8 +74,8 @@ impl Watch { /// Returns a `ReleaseShutdown` handle after the drain has been signaled. The /// handle must be dropped when a shutdown action has been completed to /// unblock graceful shutdown. - pub async fn signal(self) -> ReleaseShutdown { - self.rx.await; + pub async fn signal(mut self) -> ReleaseShutdown { + let _ = self.rx.changed().await; ReleaseShutdown(self.drained_tx) } @@ -130,7 +119,7 @@ impl Future for Drained { type Output = (); fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - match futures::ready!(self.project().drained_rx.poll_recv(cx)) { + match futures::ready!(self.project().drained_rx.poll_next(cx)) { Some(never) => match never {}, None => Poll::Ready(()), } diff --git a/linkerd/duplex/Cargo.toml b/linkerd/duplex/Cargo.toml index 82e33bcb23..06f8c7b498 100644 --- a/linkerd/duplex/Cargo.toml +++ b/linkerd/duplex/Cargo.toml @@ -6,8 +6,9 @@ edition = "2018" publish = false [dependencies] -bytes = "0.5" +bytes = "0.6" futures = "0.3" -tokio = { version = "0.2", features = ["io-util"] } +tokio = { version = "0.3", features = ["io-util"] } pin-project = "0.4" -tracing = "0.1.19" +tracing = "0.1.22" +linkerd2-io = { path = "../io" } \ No newline at end of file diff --git a/linkerd/duplex/src/lib.rs b/linkerd/duplex/src/lib.rs index 195ee91133..baa4674ec5 100644 --- a/linkerd/duplex/src/lib.rs +++ b/linkerd/duplex/src/lib.rs @@ -2,11 +2,11 @@ use bytes::{Buf, BufMut}; use futures::ready; +use io::{AsyncRead, AsyncWrite}; +use linkerd2_io as io; use pin_project::pin_project; -use std::io; use std::task::{Context, Poll}; -use std::{future::Future, mem::MaybeUninit, pin::Pin}; -use tokio::io::{AsyncRead, AsyncWrite}; +use std::{future::Future, pin::Pin}; use tracing::trace; /// A future piping data bi-directionally to In and Out. @@ -124,7 +124,7 @@ where buf.reset(); trace!("reading"); - let n = ready!(Pin::new(&mut self.io).poll_read_buf(cx, buf))?; + let n = ready!(io::poll_read_buf(Pin::new(&mut self.io), cx, buf))?; trace!("read {}B", n); is_eof = n == 0; @@ -149,7 +149,7 @@ where if let Some(ref mut buf) = self.buf { while buf.has_remaining() { trace!("writing {}B", buf.remaining()); - let n = ready!(Pin::new(&mut dst.io).poll_write_buf(cx, buf))?; + let n = ready!(io::poll_write_buf(Pin::new(&mut dst.io), cx, buf))?; trace!("wrote {}B", n); if n == 0 { return Poll::Ready(Err(write_zero())); @@ -200,18 +200,21 @@ impl Buf for CopyBuf { } } -impl BufMut for CopyBuf { +unsafe impl BufMut for CopyBuf { fn remaining_mut(&self) -> usize { self.buf.len() - self.write_pos } - fn bytes_mut(&mut self) -> &mut [MaybeUninit] { + fn bytes_mut(&mut self) -> &mut bytes::buf::UninitSlice { unsafe { // this is, in fact, _totally fine and safe_: all the memory is // initialized. // there's just no way to turn a `&[T]` into a `&[MaybeUninit]` // without ptr casting. - &mut *(&mut self.buf[self.write_pos..] as *mut _ as *mut [MaybeUninit]) + bytes::buf::UninitSlice::from_raw_parts_mut( + &mut self.buf[self.write_pos] as *mut _, + self.buf.len() - self.write_pos, + ) } } @@ -221,60 +224,60 @@ impl BufMut for CopyBuf { } } -#[cfg(test)] -mod tests { - // use std::io::{Error, Read, Result, Write}; - // use std::sync::atomic::{AtomicBool, Ordering}; - - // use super::*; - // use tokio::io::{AsyncRead, AsyncWrite}; - - // #[derive(Debug)] - // struct DoneIo(AtomicBool); - - // impl<'a> Read for &'a DoneIo { - // fn read(&mut self, buf: &mut [u8]) -> Result { - // if self.0.swap(false, Ordering::Relaxed) { - // Ok(buf.len()) - // } else { - // Ok(0) - // } - // } - // } - - // impl<'a> AsyncRead for &'a DoneIo { - // unsafe fn prepare_uninitialized_buffer(&self, _buf: &mut [u8]) -> bool { - // true - // } - // } - - // impl<'a> Write for &'a DoneIo { - // fn write(&mut self, buf: &[u8]) -> Result { - // Ok(buf.len()) - // } - // fn flush(&mut self) -> Result<()> { - // Ok(()) - // } - // } - // impl<'a> AsyncWrite for &'a DoneIo { - // fn shutdown(&mut self) -> Poll<(), Error> { - // if self.0.swap(false, Ordering::Relaxed) { - // Ok(Async::NotReady) - // } else { - // Ok(Async::Ready(())) - // } - // } - // } - - // #[test] - // fn duplex_doesnt_hang_when_one_half_finishes() { - // // Test reproducing an infinite loop in Duplex that caused issue #519, - // // where a Duplex would enter an infinite loop when one half finishes. - // let io_1 = DoneIo(AtomicBool::new(true)); - // let io_2 = DoneIo(AtomicBool::new(true)); - // let mut duplex = Duplex::new(&io_1, &io_2); - - // assert_eq!(duplex.poll().unwrap(), Async::NotReady); - // assert_eq!(duplex.poll().unwrap(), Async::Ready(())); - // } -} +// #[cfg(test)] +// mod tests { +// use std::io::{Error, Read, Result, Write}; +// use std::sync::atomic::{AtomicBool, Ordering}; + +// use super::*; +// use tokio::io::{AsyncRead, AsyncWrite}; + +// #[derive(Debug)] +// struct DoneIo(AtomicBool); + +// impl<'a> Read for &'a DoneIo { +// fn read(&mut self, buf: &mut [u8]) -> Result { +// if self.0.swap(false, Ordering::Relaxed) { +// Ok(buf.len()) +// } else { +// Ok(0) +// } +// } +// } + +// impl<'a> AsyncRead for &'a DoneIo { +// unsafe fn prepare_uninitialized_buffer(&self, _buf: &mut [u8]) -> bool { +// true +// } +// } + +// impl<'a> Write for &'a DoneIo { +// fn write(&mut self, buf: &[u8]) -> Result { +// Ok(buf.len()) +// } +// fn flush(&mut self) -> Result<()> { +// Ok(()) +// } +// } +// impl<'a> AsyncWrite for &'a DoneIo { +// fn shutdown(&mut self) -> Poll<(), Error> { +// if self.0.swap(false, Ordering::Relaxed) { +// Ok(Async::NotReady) +// } else { +// Ok(Async::Ready(())) +// } +// } +// } + +// #[test] +// fn duplex_doesnt_hang_when_one_half_finishes() { +// // Test reproducing an infinite loop in Duplex that caused issue #519, +// // where a Duplex would enter an infinite loop when one half finishes. +// let io_1 = DoneIo(AtomicBool::new(true)); +// let io_2 = DoneIo(AtomicBool::new(true)); +// let mut duplex = Duplex::new(&io_1, &io_2); + +// assert_eq!(duplex.poll().unwrap(), Async::NotReady); +// assert_eq!(duplex.poll().unwrap(), Async::Ready(())); +// } +// } diff --git a/linkerd/error-metrics/Cargo.toml b/linkerd/error-metrics/Cargo.toml index 759a649453..b72f5e1d68 100644 --- a/linkerd/error-metrics/Cargo.toml +++ b/linkerd/error-metrics/Cargo.toml @@ -10,5 +10,5 @@ publish = false futures = "0.3" indexmap = "1.0" linkerd2-metrics = { path = "../metrics" } -tower = { version = "0.3", default-features = false } +tower = { version = "0.4", default-features = false } pin-project = "0.4" \ No newline at end of file diff --git a/linkerd/error-respond/Cargo.toml b/linkerd/error-respond/Cargo.toml index c9a2f199b6..eec5144257 100644 --- a/linkerd/error-respond/Cargo.toml +++ b/linkerd/error-respond/Cargo.toml @@ -9,5 +9,5 @@ publish = false [dependencies] futures = "0.3" linkerd2-error = { path = "../error" } -tower = { version = "0.3", default-features = false } +tower = { version = "0.4", default-features = false } pin-project = "0.4" diff --git a/linkerd/exp-backoff/Cargo.toml b/linkerd/exp-backoff/Cargo.toml index 7b6516ce6e..811f94f22b 100644 --- a/linkerd/exp-backoff/Cargo.toml +++ b/linkerd/exp-backoff/Cargo.toml @@ -9,7 +9,7 @@ publish = false [dependencies] futures = "0.3" rand = { version = "0.7", features = ["small_rng"] } -tokio = { version = "0.2", features = ["time", "stream"]} +tokio = { version = "0.3", features = ["time", "stream"]} pin-project = "0.4" [dev-dependencies] diff --git a/linkerd/exp-backoff/src/lib.rs b/linkerd/exp-backoff/src/lib.rs index 53a96f36be..3cb0e03618 100644 --- a/linkerd/exp-backoff/src/lib.rs +++ b/linkerd/exp-backoff/src/lib.rs @@ -34,7 +34,7 @@ pub struct ExponentialBackoffStream { rng: SmallRng, iterations: u32, #[pin] - delay: Option, + delay: Option, } #[derive(Clone, Debug)] @@ -120,7 +120,7 @@ impl Stream for ExponentialBackoffStream { let base = this.backoff.base(*this.iterations); base + this.backoff.jitter(base, &mut this.rng) }; - this.delay.as_mut().set(Some(time::delay_for(backoff))); + this.delay.as_mut().set(Some(time::sleep(backoff))); } } } diff --git a/linkerd/http-box/Cargo.toml b/linkerd/http-box/Cargo.toml index 0c4fa2b6d1..48b987f911 100644 --- a/linkerd/http-box/Cargo.toml +++ b/linkerd/http-box/Cargo.toml @@ -6,10 +6,10 @@ edition = "2018" publish = false [dependencies] -bytes = "0.5" +bytes = "0.6" futures = "0.3" http = "0.2" -http-body = "0.3" +http-body = "0.4" linkerd2-error = { path = "../error" } -tower = {version = "0.3", default-features = false } +tower = {version = "0.4", default-features = false } pin-project = "0.4" \ No newline at end of file diff --git a/linkerd/http-box/src/payload.rs b/linkerd/http-box/src/payload.rs index 0162d90b81..ef9b9aeae4 100644 --- a/linkerd/http-box/src/payload.rs +++ b/linkerd/http-box/src/payload.rs @@ -80,6 +80,10 @@ impl bytes::Buf for Data { fn advance(&mut self, n: usize) { self.inner.advance(n) } + + fn bytes_vectored<'a>(&'a self, dst: &mut [std::io::IoSlice<'a>]) -> usize { + self.inner.bytes_vectored(dst) + } } impl Body for Inner diff --git a/linkerd/http-classify/Cargo.toml b/linkerd/http-classify/Cargo.toml index e4759c0d01..89b04aa19c 100644 --- a/linkerd/http-classify/Cargo.toml +++ b/linkerd/http-classify/Cargo.toml @@ -9,4 +9,4 @@ publish = false http = "0.2" linkerd2-error = { path = "../error" } linkerd2-stack = { path = "../stack" } -tower = { version = "0.3", default-features = false } +tower = { version = "0.4", default-features = false } diff --git a/linkerd/http-metrics/Cargo.toml b/linkerd/http-metrics/Cargo.toml index 2a5569e915..961a52aa87 100644 --- a/linkerd/http-metrics/Cargo.toml +++ b/linkerd/http-metrics/Cargo.toml @@ -6,22 +6,22 @@ edition = "2018" publish = false [dependencies] -bytes = "0.5" +bytes = "0.6" futures = "0.3" -h2 = "0.1" +h2 = { git = "https://github.com/hyperium/h2" } http = "0.2" -http-body = "0.3" -hyper = "0.13.7" +http-body = "0.4" +hyper = "0.14.0-dev" indexmap = "1.0" linkerd2-error = { path = "../error" } linkerd2-http-classify = { path = "../http-classify" } linkerd2-metrics = { path = "../metrics" } linkerd2-stack = { path = "../stack" } -tracing = "0.1.19" +tracing = "0.1.22" pin-project = "0.4" [dependencies.tower] -version = "0.3" +version = "0.4" # disable tower's tracing `log` integration for performance reasons, since we # will consume tower's traces as traces. default-features = false diff --git a/linkerd/io/Cargo.toml b/linkerd/io/Cargo.toml index 72d47506fb..fabf45a0eb 100644 --- a/linkerd/io/Cargo.toml +++ b/linkerd/io/Cargo.toml @@ -13,9 +13,13 @@ default = [] [dependencies] futures = "0.3" -bytes = "0.5" +bytes = "0.6" linkerd2-errno = { path = "../errno" } -tokio = { version = "0.2.23", features = ["io-util", "net", "macros"] } -tokio-rustls = "0.14.1" -tokio-test = { version = "0.2", optional = true } +tokio = { version = "0.3", features = ["io-util", "net"] } +tokio-rustls = "0.20" +tokio-test = { version = "0.3", optional = true } +tokio-util = { version = "0.5.1", features = ["io"] } pin-project = "0.4" + +[dev-dependencies] +tokio = { version = "0.3", features = ["rt", "macros"] } \ No newline at end of file diff --git a/linkerd/io/src/boxed.rs b/linkerd/io/src/boxed.rs index 48bda9a8ec..961abd0453 100644 --- a/linkerd/io/src/boxed.rs +++ b/linkerd/io/src/boxed.rs @@ -1,6 +1,5 @@ -use super::{internal::Io, AsyncRead, AsyncWrite, PeerAddr, Poll, Result}; -use bytes::{Buf, BufMut}; -use std::{mem::MaybeUninit, pin::Pin, task::Context}; +use super::{AsyncRead, AsyncWrite, Io, IoSlice, PeerAddr, Poll, ReadBuf, Result}; +use std::{pin::Pin, task::Context}; /// A public wrapper around a `Box`. /// @@ -21,24 +20,9 @@ impl PeerAddr for BoxedIo { } impl AsyncRead for BoxedIo { - fn poll_read(mut self: Pin<&mut Self>, cx: &mut Context, buf: &mut [u8]) -> Poll { + fn poll_read(mut self: Pin<&mut Self>, cx: &mut Context, buf: &mut ReadBuf<'_>) -> Poll<()> { self.as_mut().0.as_mut().poll_read(cx, buf) } - - fn poll_read_buf( - mut self: Pin<&mut Self>, - cx: &mut Context, - mut buf: &mut B, - ) -> Poll { - // A trait object of AsyncWrite would use the default poll_read_buf, - // which doesn't allow vectored reads. Going through this method - // allows the trait object to call the specialized poll_read_buf method. - self.as_mut().0.as_mut().poll_read_buf_erased(cx, &mut buf) - } - - unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [MaybeUninit]) -> bool { - self.0.prepare_uninitialized_buffer(buf) - } } impl AsyncWrite for BoxedIo { @@ -54,44 +38,21 @@ impl AsyncWrite for BoxedIo { self.as_mut().0.as_mut().poll_write(cx, buf) } - fn poll_write_buf( + fn poll_write_vectored( mut self: Pin<&mut Self>, cx: &mut Context, - buf: &mut B, - ) -> Poll - where - Self: Sized, - { - // A trait object of AsyncWrite would use the default poll_write_buf, - // which doesn't allow vectored writes. Going through this method - // allows the trait object to call the specialized poll_write_buf - // method. - self.as_mut().0.as_mut().poll_write_buf_erased(cx, buf) - } -} - -impl Io for BoxedIo { - /// This method is to allow using `Async::poll_write_buf` even through a - /// trait object. - fn poll_write_buf_erased( - mut self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &mut dyn Buf, + buf: &[IoSlice<'_>], ) -> Poll { - self.as_mut().0.as_mut().poll_write_buf_erased(cx, buf) + self.as_mut().0.as_mut().poll_write_vectored(cx, buf) } - /// This method is to allow using `Async::poll_read_buf` even through a - /// trait object. - fn poll_read_buf_erased( - mut self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &mut dyn BufMut, - ) -> Poll { - self.as_mut().0.as_mut().poll_read_buf_erased(cx, buf) + fn is_write_vectored(&self) -> bool { + self.0.is_write_vectored() } } +impl crate::internal::Sealed for BoxedIo {} + impl std::fmt::Debug for BoxedIo { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("BoxedIo").finish() @@ -103,7 +64,7 @@ mod tests { use super::*; #[derive(Debug)] - struct WriteBufDetector; + pub struct WriteBufDetector; impl PeerAddr for WriteBufDetector { fn peer_addr(&self) -> Result { @@ -112,7 +73,7 @@ mod tests { } impl AsyncRead for WriteBufDetector { - fn poll_read(self: Pin<&mut Self>, _: &mut Context<'_>, _: &mut [u8]) -> Poll { + fn poll_read(self: Pin<&mut Self>, _: &mut Context<'_>, _: &mut ReadBuf<'_>) -> Poll<()> { unreachable!("not called in test") } } @@ -130,33 +91,21 @@ mod tests { panic!("BoxedIo called wrong write_buf method"); } - fn poll_write_buf( - self: Pin<&mut Self>, - _: &mut Context<'_>, - _: &mut B, - ) -> Poll { - Poll::Ready(Ok(0)) + fn is_write_vectored(&self) -> bool { + true } - } - impl Io for WriteBufDetector { - fn poll_write_buf_erased( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - mut buf: &mut dyn Buf, - ) -> Poll { - self.poll_write_buf(cx, &mut buf) - } - - fn poll_read_buf_erased( + fn poll_write_vectored( self: Pin<&mut Self>, _: &mut Context<'_>, - _: &mut dyn BufMut, + _: &[std::io::IoSlice<'_>], ) -> Poll { - unreachable!("not called in test") + Poll::Ready(Ok(0)) } } + impl crate::internal::Sealed for WriteBufDetector {} + #[tokio::test] async fn boxed_io_uses_vectored_io() { use bytes::Bytes; @@ -166,7 +115,7 @@ mod tests { // This method will trigger the panic in WriteBufDetector::write IFF // BoxedIo doesn't call write_buf_erased, but write_buf, and triggering // a regular write. - match Pin::new(&mut io).poll_write_buf(cx, &mut Bytes::from("hello")) { + match Pin::new(&mut io).poll_write_buf_erased(cx, &mut Bytes::from("hello")) { Poll::Ready(Ok(_)) => {} _ => panic!("poll_write_buf should return Poll::Ready(Ok(_))"), } diff --git a/linkerd/io/src/lib.rs b/linkerd/io/src/lib.rs index 1ddaa14ca0..076ba48395 100644 --- a/linkerd/io/src/lib.rs +++ b/linkerd/io/src/lib.rs @@ -9,9 +9,11 @@ pub use self::{ prefixed::PrefixedIo, sensor::{Sensor, SensorIo}, }; -pub use std::io::{Error, ErrorKind, Read, Result, Write}; -use std::net::SocketAddr; -pub use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; +use bytes::{Buf, BufMut}; +pub use std::io::*; +use std::{net::SocketAddr, pin::Pin, task::Context}; +pub use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, ReadBuf}; +pub use tokio_util::io::{poll_read_buf, poll_write_buf}; pub type Poll = std::task::Poll>; @@ -50,86 +52,47 @@ impl PeerAddr for tokio::io::DuplexStream { Ok(([0, 0, 0, 0], 0).into()) } } -mod internal { - use super::{AsyncRead, AsyncWrite, PeerAddr, Poll}; - use bytes::{Buf, BufMut}; - use std::pin::Pin; - use std::task::Context; - - /// This trait is private, since its purpose is for creating a dynamic trait - /// object, but doing so without care can to lead not getting vectored - /// writes. - /// - /// Instead, use the concrete `BoxedIo` type. - pub trait Io: AsyncRead + AsyncWrite + PeerAddr + Send { - /// This method is to allow using `Async::polL_read_buf` even through a - /// trait object. - fn poll_read_buf_erased( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &mut dyn BufMut, - ) -> Poll; - - /// This method is to allow using `Async::poll_write_buf` even through a - /// trait object. - fn poll_write_buf_erased( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &mut dyn Buf, - ) -> Poll; - } - - impl Io for tokio::net::TcpStream { - fn poll_write_buf_erased( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - mut buf: &mut dyn Buf, - ) -> Poll { - self.poll_write_buf(cx, &mut buf) - } - fn poll_read_buf_erased( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - mut buf: &mut dyn BufMut, - ) -> Poll { - self.poll_read_buf(cx, &mut buf) - } +/// This trait is private, since its purpose is for creating a dynamic trait +/// object, but doing so without care can to lead not getting vectored +/// writes. +/// +/// Instead, use the concrete `BoxedIo` type. +pub trait Io: AsyncRead + AsyncWrite + PeerAddr + Send + internal::Sealed { + /// This method is to allow using `Async::polL_read_buf` even through a + /// trait object. + #[inline] + fn poll_read_buf_erased( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + mut buf: &mut dyn BufMut, + ) -> Poll + where + Self: Sized, + { + crate::poll_read_buf(self, cx, &mut buf) } - impl Io for tokio_rustls::server::TlsStream { - fn poll_write_buf_erased( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - mut buf: &mut dyn Buf, - ) -> Poll { - self.poll_write_buf(cx, &mut buf) - } - - fn poll_read_buf_erased( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - mut buf: &mut dyn BufMut, - ) -> Poll { - self.poll_read_buf(cx, &mut buf) - } + /// This method is to allow using `Async::poll_write_buf` even through a + /// trait object. + #[inline] + fn poll_write_buf_erased( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + mut buf: &mut dyn Buf, + ) -> Poll + where + Self: Sized, + { + crate::poll_write_buf(self, cx, &mut buf) } +} - impl Io for tokio_rustls::client::TlsStream { - fn poll_write_buf_erased( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - mut buf: &mut dyn Buf, - ) -> Poll { - self.poll_write_buf(cx, &mut buf) - } - - fn poll_read_buf_erased( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - mut buf: &mut dyn BufMut, - ) -> Poll { - self.poll_read_buf(cx, &mut buf) - } - } +impl Io for I where I: AsyncRead + AsyncWrite + PeerAddr + Send + internal::Sealed {} +mod internal { + use super::Io; + pub trait Sealed {} + impl Sealed for tokio::net::TcpStream {} + impl Sealed for tokio_rustls::server::TlsStream {} + impl Sealed for tokio_rustls::client::TlsStream {} } diff --git a/linkerd/io/src/peek.rs b/linkerd/io/src/peek.rs index 3fec6c9ce4..b9d97b18a6 100644 --- a/linkerd/io/src/peek.rs +++ b/linkerd/io/src/peek.rs @@ -59,11 +59,11 @@ impl Future for Peek { // === impl Inner === -impl Inner { +impl Inner { fn poll_peek(&mut self, cx: &mut Context<'_>) -> Poll> { if self.buf.capacity() == 0 { return Poll::Ready(Ok(self.buf.len())); } - Pin::new(&mut self.io).poll_read_buf(cx, &mut self.buf) + crate::poll_read_buf(Pin::new(&mut self.io), cx, &mut self.buf) } } diff --git a/linkerd/io/src/prefixed.rs b/linkerd/io/src/prefixed.rs index 5f66d9208c..6b45f2286e 100644 --- a/linkerd/io/src/prefixed.rs +++ b/linkerd/io/src/prefixed.rs @@ -1,9 +1,9 @@ -use crate::{internal::Io, PeerAddr, Poll}; -use bytes::{Buf, BufMut, Bytes}; +use crate::{Io, IoSlice, PeerAddr, Poll}; +use bytes::{Buf, Bytes}; use pin_project::pin_project; use std::{cmp, io}; -use std::{mem::MaybeUninit, pin::Pin, task::Context}; -use tokio::io::{AsyncRead, AsyncWrite, Result}; +use std::{pin::Pin, task::Context}; +use tokio::io::{AsyncRead, AsyncWrite, ReadBuf, Result}; /// A TcpStream where the initial reads will be served from `prefix`. #[pin_project] @@ -33,7 +33,7 @@ impl PeerAddr for PrefixedIo { } impl AsyncRead for PrefixedIo { - fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll { + fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll<()> { let this = self.project(); // Check the length only once, since looking as the length // of a Bytes isn't as cheap as the length of a &[u8]. @@ -42,8 +42,8 @@ impl AsyncRead for PrefixedIo { if peeked_len == 0 { this.io.poll_read(cx, buf) } else { - let len = cmp::min(buf.len(), peeked_len); - buf[..len].copy_from_slice(&this.prefix.as_ref()[..len]); + let len = cmp::min(buf.remaining(), peeked_len); + buf.put_slice(&this.prefix.as_ref()[..len]); this.prefix.advance(len); // If we've finally emptied the prefix, drop it so we don't // hold onto the allocated memory any longer. We won't peek @@ -51,21 +51,17 @@ impl AsyncRead for PrefixedIo { if peeked_len == len { *this.prefix = Bytes::new(); } - Poll::Ready(Ok(len)) + Poll::Ready(Ok(())) } } - - unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [MaybeUninit]) -> bool { - self.io.prepare_uninitialized_buffer(buf) - } } impl io::Write for PrefixedIo { - fn write(&mut self, buf: &[u8]) -> io::Result { + fn write(&mut self, buf: &[u8]) -> Result { self.io.write(buf) } - fn flush(&mut self) -> io::Result<()> { + fn flush(&mut self) -> Result<()> { self.io.flush() } } @@ -83,32 +79,17 @@ impl AsyncWrite for PrefixedIo { self.project().io.poll_write(cx, buf) } - fn poll_write_buf( + fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, - buf: &mut B, - ) -> Poll - where - Self: Sized, - { - self.project().io.poll_write_buf(cx, buf) - } -} - -impl Io for PrefixedIo { - fn poll_write_buf_erased( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - mut buf: &mut dyn Buf, + bufs: &[IoSlice<'_>], ) -> Poll { - self.poll_write_buf(cx, &mut buf) + self.project().io.poll_write_vectored(cx, bufs) } - fn poll_read_buf_erased( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - mut buf: &mut dyn BufMut, - ) -> Poll { - self.poll_read_buf(cx, &mut buf) + fn is_write_vectored(&self) -> bool { + self.io.is_write_vectored() } } + +impl crate::internal::Sealed for PrefixedIo {} diff --git a/linkerd/io/src/sensor.rs b/linkerd/io/src/sensor.rs index da46553559..c9fa20e238 100644 --- a/linkerd/io/src/sensor.rs +++ b/linkerd/io/src/sensor.rs @@ -1,12 +1,10 @@ -use crate::{internal::Io, PeerAddr, Poll}; -use bytes::{Buf, BufMut}; +use crate::{Io, IoSlice, PeerAddr, Poll}; use futures::ready; use linkerd2_errno::Errno; use pin_project::pin_project; -use std::mem::MaybeUninit; use std::pin::Pin; use std::task::Context; -use tokio::io::{AsyncRead, AsyncWrite, Result}; +use tokio::io::{AsyncRead, AsyncWrite, ReadBuf, Result}; pub trait Sensor { fn record_read(&mut self, sz: usize); @@ -34,26 +32,12 @@ impl SensorIo { } impl AsyncRead for SensorIo { - fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll { + fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll<()> { let this = self.project(); - let bytes = ready!(this.sensor.record_error(this.io.poll_read(cx, buf)))?; - this.sensor.record_read(bytes); - Poll::Ready(Ok(bytes)) - } - - fn poll_read_buf( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &mut B, - ) -> Poll { - let this = self.project(); - let bytes = ready!(this.sensor.record_error(this.io.poll_read_buf(cx, buf)))?; - this.sensor.record_read(bytes); - Poll::Ready(Ok(bytes)) - } - - unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [MaybeUninit]) -> bool { - self.io.prepare_uninitialized_buffer(buf) + let prev_filled = buf.filled().len(); + ready!(this.sensor.record_error(this.io.poll_read(cx, buf)))?; + this.sensor.record_read(buf.filled().len() - prev_filled); + Poll::Ready(Ok(())) } } @@ -75,36 +59,26 @@ impl AsyncWrite for SensorIo { Poll::Ready(Ok(bytes)) } - fn poll_write_buf( + fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, - buf: &mut B, + bufs: &[IoSlice<'_>], ) -> Poll { let this = self.project(); - let bytes = ready!(this.sensor.record_error(this.io.poll_write_buf(cx, buf)))?; + let bytes = ready!(this + .sensor + .record_error(this.io.poll_write_vectored(cx, bufs)))?; this.sensor.record_write(bytes); Poll::Ready(Ok(bytes)) } -} - -impl Io for SensorIo { - fn poll_write_buf_erased( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - mut buf: &mut dyn Buf, - ) -> Poll { - self.poll_write_buf(cx, &mut buf) - } - fn poll_read_buf_erased( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - mut buf: &mut dyn BufMut, - ) -> Poll { - self.poll_read_buf(cx, &mut buf) + fn is_write_vectored(&self) -> bool { + self.io.is_write_vectored() } } +impl crate::internal::Sealed for SensorIo {} + impl PeerAddr for SensorIo { fn peer_addr(&self) -> Result { self.io.peer_addr() diff --git a/linkerd/metrics/Cargo.toml b/linkerd/metrics/Cargo.toml index e317c0d0df..4ed167e906 100644 --- a/linkerd/metrics/Cargo.toml +++ b/linkerd/metrics/Cargo.toml @@ -15,7 +15,7 @@ deflate = { version = "0.7.18", features = ["gzip"] } futures = "0.3" hdrhistogram = { version = "7.1", optional = true } http = "0.2" -hyper = "0.13.7" +hyper = "0.14.0-dev" indexmap = "1.0" parking_lot = { version = "0.11", optional = true } tokio = { version = "0.2", features = ["time"], optional = true } diff --git a/linkerd/opencensus/Cargo.toml b/linkerd/opencensus/Cargo.toml index 8d29e2580a..a52020b7f6 100644 --- a/linkerd/opencensus/Cargo.toml +++ b/linkerd/opencensus/Cargo.toml @@ -12,8 +12,8 @@ linkerd2-metrics = { path = "../metrics" } opencensus-proto = { path = "../../opencensus-proto" } tokio = "0.2" tonic = { version = "0.3", default-features = false, features = ["prost", "codegen"] } -tracing = "0.1.19" +tracing = "0.1.22" pin-project = "0.4" http = "0.2" -http-body = "0.3" -tower = { version = "0.3", default-features = false } +http-body = "0.4" +tower = { version = "0.4", default-features = false } diff --git a/linkerd/proxy/api-resolve/Cargo.toml b/linkerd/proxy/api-resolve/Cargo.toml index 6eefe9fe14..b2c8965c30 100644 --- a/linkerd/proxy/api-resolve/Cargo.toml +++ b/linkerd/proxy/api-resolve/Cargo.toml @@ -12,13 +12,13 @@ Implements the Resolve trait using the proxy's gRPC API async-stream = "0.2.1" futures = "0.3" linkerd2-identity = { path = "../../identity" } -linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", tag = "v0.1.15" } +linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", rev = "259628840ba613c2e5673fc6a39b946e1b06f09a" } linkerd2-proxy-core = { path = "../core" } prost = "0.6" http = "0.2" -http-body = "0.3" +http-body = "0.4" tonic = { version = "0.3", default-features = false } indexmap = "1.0" -tower = { version = "0.3", default-features = false } -tracing = "0.1.19" +tower = { version = "0.4", default-features = false } +tracing = "0.1.22" pin-project = "0.4" diff --git a/linkerd/proxy/core/Cargo.toml b/linkerd/proxy/core/Cargo.toml index b8e909b917..66d4f34f5e 100644 --- a/linkerd/proxy/core/Cargo.toml +++ b/linkerd/proxy/core/Cargo.toml @@ -11,5 +11,5 @@ Core interfaces needed to implement proxy components [dependencies] futures = "0.3" linkerd2-error = { path = "../../error" } -tower = { version = "0.3", default-features = false } +tower = { version = "0.4", default-features = false } pin-project = "0.4" diff --git a/linkerd/proxy/discover/Cargo.toml b/linkerd/proxy/discover/Cargo.toml index 8c673fe481..9b60b240f4 100644 --- a/linkerd/proxy/discover/Cargo.toml +++ b/linkerd/proxy/discover/Cargo.toml @@ -16,13 +16,13 @@ linkerd2-error = { path = "../../error" } linkerd2-proxy-core = { path = "../core" } linkerd2-stack = { path = "../../stack" } indexmap = "1.0" -tokio = { version = "0.2", features = ["sync", "time", "stream"] } -tracing = "0.1.19" +tokio = { version = "0.3", features = ["sync", "time", "stream"] } +tracing = "0.1.22" tracing-futures = { version = "0.2", features = ["std-future"] } pin-project = "0.4" [dependencies.tower] -version = "0.3" +version = "0.4" # disable tower's tracing `log` integration for performance reasons, since we # will consume tower's traces as traces. default-features = false @@ -30,5 +30,5 @@ features = ["discover"] [dev-dependencies] async-stream = "0.2" -tokio = { version = "0.2", features = ["macros", "rt-core"] } -tower = { version = "0.3", default-features = false, features = ["discover", "util"]} +tokio = { version = "0.3", features = ["macros", "rt"] } +tower = { version = "0.4", default-features = false, features = ["discover", "util"]} diff --git a/linkerd/proxy/discover/src/buffer.rs b/linkerd/proxy/discover/src/buffer.rs index dc6d49c197..c490e5e035 100644 --- a/linkerd/proxy/discover/src/buffer.rs +++ b/linkerd/proxy/discover/src/buffer.rs @@ -7,7 +7,7 @@ use std::pin::Pin; use std::task::{Context, Poll}; use std::time::Duration; use tokio::sync::oneshot; -use tokio::time::{self, Delay}; +use tokio::time::{self, Sleep}; use tower::discover; use tracing::warn; use tracing_futures::Instrument; @@ -44,7 +44,7 @@ pub struct Daemon { disconnect_rx: oneshot::Receiver, tx: mpsc::Sender>, #[pin] - watchdog: Option, + watchdog: Option, watchdog_timeout: Duration, } @@ -159,7 +159,7 @@ where if this.watchdog.as_mut().as_pin_mut().is_none() { this.watchdog .as_mut() - .set(Some(time::delay_for(*this.watchdog_timeout))); + .set(Some(time::sleep(*this.watchdog_timeout))); } if this diff --git a/linkerd/proxy/dns-resolve/Cargo.toml b/linkerd/proxy/dns-resolve/Cargo.toml index 6e6e161d04..84cf34e892 100644 --- a/linkerd/proxy/dns-resolve/Cargo.toml +++ b/linkerd/proxy/dns-resolve/Cargo.toml @@ -14,12 +14,12 @@ linkerd2-error = { path = "../../error" } linkerd2-addr = { path = "../../addr" } linkerd2-dns = { path = "../../dns" } linkerd2-proxy-core = { path = "../core" } -tokio = { version = "0.2", features = ["stream", "sync"] } +tokio = { version = "0.3", features = ["stream", "sync"] } tracing = "0.1.9" tracing-futures = "0.2" [dependencies.tower] -version = "0.3" +version = "0.4" # disable tower's tracing `log` integration for performance reasons, since we # will consume tower's traces as traces. default-features = false diff --git a/linkerd/proxy/dns-resolve/src/lib.rs b/linkerd/proxy/dns-resolve/src/lib.rs index 1b5fc29e58..9ef9b858a1 100644 --- a/linkerd/proxy/dns-resolve/src/lib.rs +++ b/linkerd/proxy/dns-resolve/src/lib.rs @@ -66,7 +66,7 @@ async fn resolution(dns: dns::Resolver, na: NameAddr) -> Result h1.request(req), Self::OrigProtoUpgrade(ref mut svc) => svc.call(req), - Self::H2(ref mut svc) => Box::pin(svc.call(req)) as RspFuture, + Self::H2(ref mut svc) => { + Box::pin(svc.call(req).map_ok(|rsp| rsp.map(Body::from))) as RspFuture + } } }) .instrument(span) diff --git a/linkerd/proxy/http/src/client_handle.rs b/linkerd/proxy/http/src/client_handle.rs index 46cc838cc9..1298a91d42 100644 --- a/linkerd/proxy/http/src/client_handle.rs +++ b/linkerd/proxy/http/src/client_handle.rs @@ -35,7 +35,7 @@ pub struct SetClientHandle { impl Close { pub fn close(&self) { - self.0.notify() + self.0.notify_one() } } diff --git a/linkerd/proxy/http/src/detect.rs b/linkerd/proxy/http/src/detect.rs index 22d0f56681..9d6f401467 100644 --- a/linkerd/proxy/http/src/detect.rs +++ b/linkerd/proxy/http/src/detect.rs @@ -168,7 +168,7 @@ where .serve_connection( io, // Enable support for HTTP upgrades (CONNECT and websockets). - HyperServerSvc::new(upgrade::Service::new(svc, drain.clone())), + upgrade::Service::new(svc, drain.clone()), ) .with_upgrades(); diff --git a/linkerd/proxy/http/src/glue.rs b/linkerd/proxy/http/src/glue.rs index 3c73871dae..7c7ca3b16c 100644 --- a/linkerd/proxy/http/src/glue.rs +++ b/linkerd/proxy/http/src/glue.rs @@ -1,20 +1,15 @@ use crate::{upgrade::Http11Upgrade, HasH2Reason}; -use bytes::{ - buf::{Buf, BufMut}, - Bytes, -}; +use bytes::Bytes; use futures::TryFuture; use http; +use hyper::body::HttpBody; use hyper::client::connect as hyper_connect; -use hyper::{self, body::HttpBody}; use linkerd2_error::Error; +use linkerd2_io::{self as io, AsyncRead, AsyncWrite}; use pin_project::{pin_project, pinned_drop}; use std::future::Future; -use std::io; -use std::mem::MaybeUninit; use std::pin::Pin; use std::task::{Context, Poll}; -use tokio::io::{AsyncRead, AsyncWrite}; use tracing::debug; /// Provides optional HTTP/1.1 upgrade support on the body. @@ -23,8 +18,8 @@ use tracing::debug; pub struct Body { /// In UpgradeBody::drop, if this was an HTTP upgrade, the body is taken /// to be inserted into the Http11Upgrade half. - body: Option, - pub(super) upgrade: Option, + body: hyper::Body, + pub(super) upgrade: Option<(Http11Upgrade, hyper::upgrade::OnUpgrade)>, } /// Glue for a `tower::Service` to used as a `hyper::server::Service`. @@ -56,7 +51,6 @@ pub struct HyperConnectFuture { inner: F, absolute_form: bool, } - // ===== impl UpgradeBody ===== impl HttpBody for Body { @@ -64,17 +58,14 @@ impl HttpBody for Body { type Error = hyper::Error; fn is_end_stream(&self) -> bool { - self.body - .as_ref() - .expect("only taken in drop") - .is_end_stream() + self.body.is_end_stream() } fn poll_data( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll>> { - let body = self.project().body.as_mut().expect("only taken in drop"); + let body = self.project().body; let poll = futures::ready!(Pin::new(body) // `hyper::Body` is Unpin .poll_data(cx)); Poll::Ready(poll.map(|x| { @@ -89,7 +80,7 @@ impl HttpBody for Body { self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll, Self::Error>> { - let body = self.project().body.as_mut().expect("only taken in drop"); + let body = self.project().body; Pin::new(body) // `hyper::Body` is Unpin .poll_trailers(cx) .map_err(|e| { @@ -108,18 +99,18 @@ impl Default for Body { impl From for Body { fn from(body: hyper::Body) -> Self { Body { - body: Some(body), + body, upgrade: None, } } } impl Body { - pub(crate) fn new(body: hyper::Body, upgrade: Option) -> Self { - Body { - body: Some(body), - upgrade: upgrade, - } + pub(crate) fn new( + body: hyper::Body, + upgrade: Option<(Http11Upgrade, hyper::upgrade::OnUpgrade)>, + ) -> Self { + Body { body, upgrade } } } @@ -128,8 +119,7 @@ impl PinnedDrop for Body { fn drop(self: Pin<&mut Self>) { let this = self.project(); // If an HTTP/1 upgrade was wanted, send the upgrade future. - if let Some(upgrade) = this.upgrade.take() { - let on_upgrade = this.body.take().expect("take only on drop").on_upgrade(); + if let Some((upgrade, on_upgrade)) = this.upgrade.take() { upgrade.insert_half(on_upgrade); } } @@ -156,8 +146,8 @@ where } fn call(&mut self, req: http::Request) -> Self::Future { - self.service.call(req.map(|b| Body { - body: Some(b), + self.service.call(req.map(|body| Body { + body, upgrade: None, })) } @@ -231,28 +221,13 @@ impl AsyncRead for Connection where C: AsyncRead, { - unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [MaybeUninit]) -> bool { - self.transport.prepare_uninitialized_buffer(buf) - } - fn poll_read( self: Pin<&mut Self>, cx: &mut Context<'_>, - buf: &mut [u8], - ) -> Poll> { + buf: &mut io::ReadBuf<'_>, + ) -> Poll> { self.project().transport.poll_read(cx, buf) } - - fn poll_read_buf( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &mut B, - ) -> Poll> - where - Self: Sized, - { - self.project().transport.poll_read_buf(cx, buf) - } } impl AsyncWrite for Connection @@ -267,6 +242,14 @@ where self.project().transport.poll_write(cx, buf) } + fn poll_write_vectored( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + bufs: &[io::IoSlice<'_>], + ) -> Poll> { + self.project().transport.poll_write_vectored(cx, bufs) + } + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { self.project().transport.poll_flush(cx) } @@ -275,15 +258,8 @@ where self.project().transport.poll_shutdown(cx) } - fn poll_write_buf( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &mut B, - ) -> Poll> - where - Self: Sized, - { - self.project().transport.poll_write_buf(cx, buf) + fn is_write_vectored(&self) -> bool { + self.transport.is_write_vectored() } } diff --git a/linkerd/proxy/http/src/h1.rs b/linkerd/proxy/http/src/h1.rs index dc039b32f9..c14ae2ddb3 100644 --- a/linkerd/proxy/http/src/h1.rs +++ b/linkerd/proxy/http/src/h1.rs @@ -144,11 +144,14 @@ where if is_upgrade(&rsp) { trace!("Client response is HTTP/1.1 upgrade"); + if let Some(upgrade) = upgrade { + upgrade.insert_half(hyper::upgrade::on(&mut rsp)); + } } else { strip_connection_headers(rsp.headers_mut()); } - rsp.map(move |b| Body::new(b, upgrade)) + rsp.map(Body::from) })) } } diff --git a/linkerd/proxy/http/src/h2.rs b/linkerd/proxy/http/src/h2.rs index e882e8a2ae..28e429f1f7 100644 --- a/linkerd/proxy/http/src/h2.rs +++ b/linkerd/proxy/http/src/h2.rs @@ -1,5 +1,5 @@ -use crate::{glue::Body, trace}; -use futures::{future, prelude::*}; +use crate::trace; +use futures::prelude::*; use http; use hyper::{ body::HttpBody, @@ -136,12 +136,9 @@ where B::Data: Send, B::Error: Into + Send + Sync, { - type Response = http::Response; + type Response = http::Response; type Error = hyper::Error; - type Future = future::MapOk< - conn::ResponseFuture, - fn(http::Response) -> http::Response, - >; + type Future = conn::ResponseFuture; fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { self.tx.poll_ready(cx).map_err(From::from) @@ -162,6 +159,6 @@ where *req.version_mut() = http::Version::HTTP_11; } - self.tx.send_request(req).map_ok(|rsp| rsp.map(Body::from)) + self.tx.send_request(req) } } diff --git a/linkerd/proxy/http/src/orig_proto.rs b/linkerd/proxy/http/src/orig_proto.rs index 4867639407..bd6db316bd 100644 --- a/linkerd/proxy/http/src/orig_proto.rs +++ b/linkerd/proxy/http/src/orig_proto.rs @@ -101,7 +101,7 @@ where .unwrap_or(orig_version); trace!(?version, "Downgrading response"); *rsp.version_mut() = version; - rsp + rsp.map(Body::from) })) } } diff --git a/linkerd/proxy/http/src/upgrade.rs b/linkerd/proxy/http/src/upgrade.rs index c28aae889b..465117990a 100644 --- a/linkerd/proxy/http/src/upgrade.rs +++ b/linkerd/proxy/http/src/upgrade.rs @@ -173,7 +173,7 @@ impl Service { } } -impl tower::Service> for Service +impl tower::Service> for Service where S: tower::Service, Response = http::Response>, B: Default, @@ -186,7 +186,7 @@ where self.service.poll_ready(cx) } - fn call(&mut self, mut req: http::Request) -> Self::Future { + fn call(&mut self, mut req: http::Request) -> Self::Future { // Should this rejection happen later in the Service stack? // // Rejecting here means telemetry doesn't record anything about it... @@ -207,14 +207,15 @@ where // Setup HTTP Upgrade machinery. let halves = Http11Upgrade::new(self.upgrade_drain_signal.clone()); req.extensions_mut().insert(halves.client); + let on_upgrade = hyper::upgrade::on(&mut req); - Some(halves.server) + Some((halves.server, on_upgrade)) } else { h1::strip_connection_headers(req.headers_mut()); None }; - req.body_mut().upgrade = upgrade; + let req = req.map(|body| Body::new(body, upgrade)); Either::Left(self.service.call(req)) } diff --git a/linkerd/proxy/identity/Cargo.toml b/linkerd/proxy/identity/Cargo.toml index c7419a3c0e..b68f22f2f7 100644 --- a/linkerd/proxy/identity/Cargo.toml +++ b/linkerd/proxy/identity/Cargo.toml @@ -9,10 +9,10 @@ publish = false futures = "0.3" linkerd2-error = { path = "../../error" } linkerd2-identity = { path = "../../identity" } -linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", tag = "v0.1.15" } +linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", rev = "259628840ba613c2e5673fc6a39b946e1b06f09a" } linkerd2-proxy-transport = { path = "../transport" } -tokio = { version = "0.2", features = ["time", "sync"] } +tokio = { version = "0.3", features = ["time", "sync"] } tonic = { version = "0.3", default-features = false } -tracing = "0.1.19" -http-body = "0.3" +tracing = "0.1.22" +http-body = "0.4" pin-project = "0.4" diff --git a/linkerd/proxy/identity/src/certify.rs b/linkerd/proxy/identity/src/certify.rs index 7257345ef1..b3462fd7af 100644 --- a/linkerd/proxy/identity/src/certify.rs +++ b/linkerd/proxy/identity/src/certify.rs @@ -8,7 +8,7 @@ use std::convert::TryFrom; use std::sync::Arc; use std::time::{Duration, SystemTime, UNIX_EPOCH}; use tokio::sync::watch; -use tokio::time::{self, Delay}; +use tokio::time::{self, Sleep}; use tonic::{ self as grpc, body::{Body, BoxBody}, @@ -95,7 +95,7 @@ where } Ok(crt_key) => { debug!("daemon certified until {:?}", expiry); - if crt_key_watch.broadcast(Some(crt_key)).is_err() { + if crt_key_watch.send(Some(crt_key)).is_err() { // If we can't store a value, than all observations // have been dropped and we can stop refreshing. return; @@ -122,7 +122,7 @@ impl Config { /// /// A refresh is scheduled at 70% of the current certificate's lifetime; /// though it is never less than min_refresh or larger than max_refresh. - fn refresh(&self, expiry: SystemTime) -> Delay { + fn refresh(&self, expiry: SystemTime) -> Sleep { let refresh = match expiry .duration_since(SystemTime::now()) .ok() @@ -134,7 +134,7 @@ impl Config { Some(lifetime) => lifetime, }; trace!("will refresh in {:?}", refresh); - time::delay_for(refresh) + time::sleep(refresh) } } @@ -158,7 +158,7 @@ impl Local { pub async fn await_crt(mut self) -> Result { while self.crt_key.borrow().is_none() { // If the sender is dropped, the daemon task has ended. - if let None = self.crt_key.recv().await { + if self.crt_key.changed().await.is_err() { return Err(LostDaemon); } } diff --git a/linkerd/proxy/resolve/Cargo.toml b/linkerd/proxy/resolve/Cargo.toml index edba4b42b1..843d315520 100644 --- a/linkerd/proxy/resolve/Cargo.toml +++ b/linkerd/proxy/resolve/Cargo.toml @@ -16,7 +16,7 @@ tracing = "0.1" pin-project = "0.4" [dependencies.tower] -version = "0.3" +version = "0.4" # disable tower's tracing `log` integration for performance reasons, since we # will consume tower's traces as traces. default-features = false diff --git a/linkerd/proxy/tap/Cargo.toml b/linkerd/proxy/tap/Cargo.toml index 42c21bc767..56b58300bc 100644 --- a/linkerd/proxy/tap/Cargo.toml +++ b/linkerd/proxy/tap/Cargo.toml @@ -6,27 +6,26 @@ edition = "2018" publish = false [dependencies] -bytes = "0.5" http = "0.2" -hyper = "0.13.7" +hyper = "0.14.0-dev" futures = "0.3" indexmap = "1.0" ipnet = "2.0" linkerd2-conditional = { path = "../../conditional" } linkerd2-error = { path = "../../error" } linkerd2-identity = { path = "../../identity" } -linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", tag = "v0.1.15" } +linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", rev = "259628840ba613c2e5673fc6a39b946e1b06f09a" } linkerd2-proxy-http = { path = "../http" } linkerd2-proxy-transport = { path = "../transport" } linkerd2-stack = { path = "../../stack" } rand = { version = "0.7" } -tokio = { version = "0.2", features = ["time"]} -tower = {version = "0.3", default-features = false } +tokio = { version = "0.3", features = ["time"]} +tower = { version = "0.4", default-features = false } tonic = { version = "0.3", default-features = false } -tracing = "0.1.19" +tracing = "0.1.22" tracing-futures = "0.2" pin-project = "0.4" [dev-dependencies] -linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", tag = "v0.1.15", features = ["arbitrary"] } +linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", rev = "259628840ba613c2e5673fc6a39b946e1b06f09a", features = ["arbitrary"] } prost-types = "0.6.0" diff --git a/linkerd/proxy/tap/src/grpc/server.rs b/linkerd/proxy/tap/src/grpc/server.rs index 6fa5b4745e..3bf05239c4 100644 --- a/linkerd/proxy/tap/src/grpc/server.rs +++ b/linkerd/proxy/tap/src/grpc/server.rs @@ -1,8 +1,7 @@ use super::match_::Match; use crate::{iface, Inspect, Registry}; -use bytes::Buf; use futures::ready; -use hyper::body::HttpBody; +use hyper::body::{Buf, HttpBody}; use linkerd2_conditional::Conditional; use linkerd2_proxy_api::{http_types, pb_duration, tap as api}; use linkerd2_proxy_http::HasH2Reason; @@ -266,7 +265,7 @@ impl iface::Tap for Tap { return None; } }; - let mut events_tx = shared.events_tx.clone(); + let events_tx = shared.events_tx.clone(); let request_init_at = Instant::now(); @@ -353,7 +352,7 @@ impl iface::Tap for Tap { impl iface::TapResponse for TapResponse { type TapPayload = TapResponsePayload; - fn tap(mut self, rsp: &http::Response) -> TapResponsePayload { + fn tap(self, rsp: &http::Response) -> TapResponsePayload { let response_init_at = Instant::now(); let headers = if self.extract_headers { @@ -401,7 +400,7 @@ impl iface::TapResponse for TapResponse { } } - fn fail(mut self, err: &E) { + fn fail(self, err: &E) { let response_end_at = Instant::now(); let reason = err.h2_reason(); let end = api::tap_event::http::Event::ResponseEnd(api::tap_event::http::ResponseEnd { @@ -463,7 +462,7 @@ impl iface::TapPayload for TapResponsePayload { } impl TapResponsePayload { - fn send(mut self, end: Option, trls: Option<&http::HeaderMap>) { + fn send(self, end: Option, trls: Option<&http::HeaderMap>) { let response_end_at = Instant::now(); let trailers = if self.extract_headers { trls.map(|trls| headers_to_pb(iter::empty(), trls)) diff --git a/linkerd/proxy/tap/src/lib.rs b/linkerd/proxy/tap/src/lib.rs index 7eba90bf2a..6ad0488ea2 100644 --- a/linkerd/proxy/tap/src/lib.rs +++ b/linkerd/proxy/tap/src/lib.rs @@ -82,8 +82,8 @@ pub trait Inspect { /// for Registry/Layer/grpc, but need not be implemented outside of the `tap` /// module. mod iface { - use bytes::Buf; use http; + use hyper::body::Buf; use hyper::body::HttpBody; use linkerd2_proxy_http::HasH2Reason; diff --git a/linkerd/proxy/tap/src/registry.rs b/linkerd/proxy/tap/src/registry.rs index 842624bc81..b6fedba12e 100644 --- a/linkerd/proxy/tap/src/registry.rs +++ b/linkerd/proxy/tap/src/registry.rs @@ -39,7 +39,7 @@ where pub fn register(&self, tap: T) { if let Ok(mut inner) = self.inner.lock() { inner.taps.push(tap); - let _ = inner.taps_send.broadcast(inner.taps.clone()); + let _ = inner.taps_send.send(inner.taps.clone()); } } diff --git a/linkerd/proxy/tcp/Cargo.toml b/linkerd/proxy/tcp/Cargo.toml index 6bce2ee111..a1ae072977 100644 --- a/linkerd/proxy/tcp/Cargo.toml +++ b/linkerd/proxy/tcp/Cargo.toml @@ -11,7 +11,7 @@ futures = { version = "0.3", features = ["compat"] } linkerd2-duplex = { path = "../../duplex" } linkerd2-error = { path = "../../error" } linkerd2-stack = { path = "../../stack" } -rand = { version = "0.7" } -tokio = { version = "0.2" } -tower = { version = "0.3", default-features = false, features = ["balance", "load", "discover"] } +rand = "0.7" +tokio = { version = "0.3" } +tower = { version = "0.4", default-features = false, features = ["balance", "load", "discover"] } pin-project = "0.4" diff --git a/linkerd/proxy/transport/Cargo.toml b/linkerd/proxy/transport/Cargo.toml index 1332e3275c..cb28f04c3a 100644 --- a/linkerd/proxy/transport/Cargo.toml +++ b/linkerd/proxy/transport/Cargo.toml @@ -15,7 +15,7 @@ mock-orig-dst = [] [dependencies] async-stream = "0.2.1" -bytes = "0.5" +bytes = "0.6" futures = "0.3" indexmap = "1.0.0" linkerd2-conditional = { path = "../../conditional" } @@ -27,16 +27,17 @@ linkerd2-io = { path = "../../io" } linkerd2-metrics = { path = "../../metrics" } linkerd2-stack = { path = "../../stack" } rustls = "0.18" -tokio = { version = "0.2", features = ["net", "io-util"]} -tokio-rustls = "0.14.1" -tracing = "0.1.19" +tokio = { version = "0.3", features = ["net", "io-util"]} +tokio-rustls = "0.20" +tracing = "0.1.22" webpki = "0.21" untrusted = "0.7" pin-project = "0.4" -tokio-util = { version = "0.3", features = ["compat"]} +tokio-util = { version = "0.5", features = ["compat"]} +socket2 = "0.3" [dependencies.tower] -version = "0.3" +version = "0.4" # disable tower's tracing `log` integration for performance reasons, since we # will consume tower's traces as traces. default-features = false @@ -49,5 +50,5 @@ libc = "0.2" [dev-dependencies] linkerd2-identity = { path = "../../identity", features = ["test-util"] } tracing-subscriber = "0.2.14" -tower = { version = "0.3", default-features = false, features = ["util"] } +tower = { version = "0.4", default-features = false, features = ["util"] } tracing-futures = { version = "0.2", features = ["std-future"] } diff --git a/linkerd/proxy/transport/src/lib.rs b/linkerd/proxy/transport/src/lib.rs index c143eeaa91..1a8caff4c3 100644 --- a/linkerd/proxy/transport/src/lib.rs +++ b/linkerd/proxy/transport/src/lib.rs @@ -27,7 +27,43 @@ fn set_nodelay_or_warn(socket: &TcpStream) { } fn set_keepalive_or_warn(tcp: &TcpStream, ka: Option) { - if let Err(e) = tcp.set_keepalive(ka) { + // TODO(eliza): when https://github.com/tokio-rs/tokio/pull/3189 merges + // upstream, we will be able to convert the Tokio `TcpStream` into a + // `socket2::Socket` without unsafe, by converting it to a + // `std::net::TcpStream` (as `socket2::Socket` has a + // `From`). What we're doing now is more or less + // equivalent, but this would use a safe interface... + #[cfg(unix)] + let sock = unsafe { + // Safety: `from_raw_fd` takes ownership of the underlying file + // descriptor, and will close it when dropped. However, we obtain the + // file descriptor via `as_raw_fd` rather than `into_raw_fd`, so the + // Tokio `TcpStream` *also* retains ownership of the socket --- which is + // what we want. Instead of letting the `socket2` socket returned by + // `from_raw_fd` close the fd, we `mem::forget` the `Socket`, so that + // its `Drop` impl will not run. This ensures the fd is not closed + // prematurely. + use std::os::unix::io::{AsRawFd, FromRawFd}; + socket2::Socket::from_raw_fd(tcp.as_raw_fd()) + }; + #[cfg(windows)] + let sock = unsafe { + // Safety: `from_raw_socket` takes ownership of the underlying Windows + // SOCKET, and will close it when dropped. However, we obtain the + // SOCKET via `as_raw_socket` rather than `into_raw_socket`, so the + // Tokio `TcpStream` *also* retains ownership of the socket --- which is + // what we want. Instead of letting the `socket2` socket returned by + // `from_raw_socket` close the SOCKET, we `mem::forget` the `Socket`, so + // that its `Drop` impl will not run. This ensures the socket is not + // closed prematurely. + use std::os::windows::io::{AsRawSocket, FromRawSocket}; + socket2::Socket::from_raw_socket(tcp.as_raw_socket()) + }; + + if let Err(e) = sock.set_keepalive(ka) { tracing::warn!("failed to set keepalive: {}", e); } + + // Don't let the socket2 socket close the fd on drop! + std::mem::forget(sock); } diff --git a/linkerd/proxy/transport/src/listen.rs b/linkerd/proxy/transport/src/listen.rs index ad42d3dd5a..340b397f3f 100644 --- a/linkerd/proxy/transport/src/listen.rs +++ b/linkerd/proxy/transport/src/listen.rs @@ -66,6 +66,8 @@ impl Bind { pub fn bind(&self) -> io::Result<(SocketAddr, impl Stream>)> { let listen = std::net::TcpListener::bind(self.bind_addr)?; + // Ensure that O_NONBLOCK is set on the socket before using it with Tokio. + listen.set_nonblocking(true)?; let addr = listen.local_addr()?; let keepalive = self.keepalive; let get_orig = self.orig_dst_addr.clone(); diff --git a/linkerd/proxy/transport/src/tls/accept.rs b/linkerd/proxy/transport/src/tls/accept.rs index e65843ef78..1093484a96 100644 --- a/linkerd/proxy/transport/src/tls/accept.rs +++ b/linkerd/proxy/transport/src/tls/accept.rs @@ -127,7 +127,7 @@ where Conditional::Some(local) => { let config = local.tls_server_config(); let name = local.tls_server_name(); - let timeout = tokio::time::delay_for(self.timeout); + let timeout = tokio::time::sleep(self.timeout); Box::pin(async move { let (peer_identity, io) = tokio::select! { diff --git a/linkerd/reconnect/Cargo.toml b/linkerd/reconnect/Cargo.toml index bb04a0b567..286badde2c 100644 --- a/linkerd/reconnect/Cargo.toml +++ b/linkerd/reconnect/Cargo.toml @@ -9,6 +9,6 @@ publish = false linkerd2-error = { path = "../error" } linkerd2-stack = { path = "../stack" } futures = "0.3" -tower = { version = "0.3", default-features = false } -tracing = "0.1.19" +tower = { version = "0.4", default-features = false } +tracing = "0.1.22" pin-project = "0.4" diff --git a/linkerd/retry/Cargo.toml b/linkerd/retry/Cargo.toml index 0dba1bf0f3..75b395af14 100644 --- a/linkerd/retry/Cargo.toml +++ b/linkerd/retry/Cargo.toml @@ -8,6 +8,6 @@ publish = false [dependencies] linkerd2-error = { path = "../error" } linkerd2-stack = { path = "../stack" } -tower = { version = "0.3", default-features = false, features = ["retry", "util"] } -tracing = "0.1.19" +tower = { version = "0.4", default-features = false, features = ["retry", "util"] } +tracing = "0.1.22" pin-project = "0.4" diff --git a/linkerd/service-profiles/Cargo.toml b/linkerd/service-profiles/Cargo.toml index 51105e9850..62bcd45d48 100644 --- a/linkerd/service-profiles/Cargo.toml +++ b/linkerd/service-profiles/Cargo.toml @@ -9,27 +9,28 @@ Implements client layers for Linkerd ServiceProfiles. """ [dependencies] -bytes = "0.5" +bytes = "0.6" futures = "0.3" http = "0.2" -http-body = "0.3" +http-body = "0.4" indexmap = "1.0" linkerd2-addr = { path = "../addr" } linkerd2-dns-name = { path = "../dns/name" } linkerd2-error = { path = "../error" } -linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", tag = "v0.1.15" } +linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", rev = "259628840ba613c2e5673fc6a39b946e1b06f09a" } linkerd2-proxy-api-resolve = { path = "../proxy/api-resolve" } linkerd2-stack = { path = "../stack" } rand = { version = "0.7", features = ["small_rng"] } regex = "1.0.0" -tokio = { version = "0.2", features = ["macros", "rt-core", "sync", "time"] } +tokio = { version = "0.3", features = ["macros", "rt", "sync", "time"] } +async-stream = "0.3" tonic = { version = "0.3", default-features = false } -tracing = "0.1.19" +tracing = "0.1.22" tracing-futures = { version = "0.2", features = ["std-future"] } pin-project = "0.4" [dependencies.tower] -version = "0.3" +version = "0.4" # disable tower's tracing `log` integration for performance reasons, since we # will consume tower's traces as traces. default-features = false @@ -40,6 +41,6 @@ features = [ ] [dev-dependencies] -linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", tag = "v0.1.15", features = ["arbitrary"] } +linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", rev = "259628840ba613c2e5673fc6a39b946e1b06f09a", features = ["arbitrary"] } prost-types = "0.6.0" quickcheck = { version = "0.9", default-features = false } diff --git a/linkerd/service-profiles/src/client.rs b/linkerd/service-profiles/src/client.rs index e15f8927b5..1acae247f2 100644 --- a/linkerd/service-profiles/src/client.rs +++ b/linkerd/service-profiles/src/client.rs @@ -175,7 +175,7 @@ where }; trace!("daemonizing"); - let (mut tx, rx) = watch::channel(profile); + let (tx, rx) = watch::channel(profile); let inner = this.inner.take().expect("polled after ready"); let daemon = async move { tokio::pin!(inner); @@ -195,7 +195,7 @@ where } Ok(profile) => { trace!(?profile, "publishing"); - if tx.broadcast(profile).is_err() { + if tx.send(profile).is_err() { trace!("failed to publish profile"); return; } diff --git a/linkerd/service-profiles/src/http/route_request.rs b/linkerd/service-profiles/src/http/route_request.rs index 22372909ad..37779837b8 100644 --- a/linkerd/service-profiles/src/http/route_request.rs +++ b/linkerd/service-profiles/src/http/route_request.rs @@ -1,11 +1,12 @@ use super::{Receiver, RequestMatch, Route}; use crate::Profile; -use futures::{future::ErrInto, prelude::*, ready}; +use futures::{future::ErrInto, prelude::*, ready, Stream}; use linkerd2_error::Error; use linkerd2_stack::{layer, NewService, Proxy}; use std::{ collections::HashMap, marker::PhantomData, + pin::Pin, task::{Context, Poll}, }; use tracing::{debug, trace}; @@ -33,7 +34,7 @@ pub struct NewRouteRequest { pub struct RouteRequest { target: T, - rx: Option, + rx: Option + Send + Sync>>>, inner: S, new_route: N, http_routes: Vec<(RequestMatch, Route)>, @@ -62,7 +63,7 @@ where type Service = RouteRequest; fn new_service(&mut self, target: T) -> Self::Service { - let rx = (&target).into(); + let rx = (&target).into().map(crate::stream_profile); let inner = self.inner.new_service(target.clone()); let default = self .new_route @@ -95,8 +96,9 @@ where fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { let mut update = None; if let Some(rx) = self.rx.as_mut() { - while let Poll::Ready(Some(up)) = rx.poll_recv_ref(cx) { - update = Some(up.clone()); + while let Poll::Ready(Some(up)) = rx.as_mut().poll_next(cx) { + tracing::trace!(update = ?up, "updated profile"); + update = Some(up); } } diff --git a/linkerd/service-profiles/src/lib.rs b/linkerd/service-profiles/src/lib.rs index ede17c6ac1..360030b36d 100644 --- a/linkerd/service-profiles/src/lib.rs +++ b/linkerd/service-profiles/src/lib.rs @@ -1,5 +1,6 @@ #![deny(warnings, rust_2018_idioms)] +use futures::stream::Stream; use linkerd2_addr::Addr; pub use linkerd2_dns_name::Name; use linkerd2_error::Error; @@ -7,6 +8,7 @@ use linkerd2_proxy_api_resolve::Metadata; use std::{ future::Future, net::SocketAddr, + pin::Pin, task::{Context, Poll}, }; use tower::util::{Oneshot, ServiceExt}; @@ -83,3 +85,19 @@ where self.0.get_profile(target) } } + +fn stream_profile(mut rx: Receiver) -> Pin + Send + Sync>> { + Box::pin(async_stream::stream! { + loop { + let val = rx.borrow().clone(); + yield val; + // This is a loop with a return condition rather than a while loop, + // because we want to yield the *first* value immediately, rather + // than waiting for the profile to change again. + if let Err(_) = rx.changed().await { + tracing::trace!("profile sender dropped"); + return; + } + } + }) +} diff --git a/linkerd/service-profiles/src/split.rs b/linkerd/service-profiles/src/split.rs index 8f55a7e269..4146f63840 100644 --- a/linkerd/service-profiles/src/split.rs +++ b/linkerd/service-profiles/src/split.rs @@ -29,17 +29,15 @@ pub struct NewSplit { _service: PhantomData S>, } -#[derive(Debug)] pub struct Split { inner: Inner, } -#[derive(Debug)] enum Inner { Default(S), Split { rng: SmallRng, - rx: Receiver, + rx: Pin + Send + Sync>>, target: T, new_service: N, distribution: WeightedIndex, @@ -105,7 +103,7 @@ where } Inner::Split { - rx, + rx: crate::stream_profile(rx), target, new_service, services, @@ -150,7 +148,7 @@ where .. } => { let mut update = None; - while let Poll::Ready(Some(up)) = rx.poll_recv_ref(cx) { + while let Poll::Ready(Some(up)) = rx.as_mut().poll_next(cx) { update = Some(up.clone()); } diff --git a/linkerd/signal/Cargo.toml b/linkerd/signal/Cargo.toml index 0e88670fd0..c62bc85aa3 100644 --- a/linkerd/signal/Cargo.toml +++ b/linkerd/signal/Cargo.toml @@ -6,5 +6,5 @@ edition = "2018" publish = false [dependencies] -tokio = { version = "0.2", features = ["macros", "signal"] } -tracing = "0.1.19" +tokio = { version = "0.3", features = ["macros", "signal"] } +tracing = "0.1.22" diff --git a/linkerd/stack/Cargo.toml b/linkerd/stack/Cargo.toml index bff48cb758..b83e07147d 100644 --- a/linkerd/stack/Cargo.toml +++ b/linkerd/stack/Cargo.toml @@ -13,11 +13,11 @@ dyn-clone = "1.0.3" futures = "0.3" linkerd2-error = { path = "../error" } pin-project = "0.4" -tokio = { version = "0.2", features = ["time"] } +tokio = { version = "0.3", features = ["time"] } tracing = "0.1" [dependencies.tower] -version = "0.3" +version = "0.4" # disable tower's tracing `log` integration for performance reasons, since we # will consume tower's traces as traces. default-features = false @@ -29,4 +29,4 @@ features = [ tower-test = "0.3" tokio-test = "0.2" tracing-subscriber = "0.2.14" -tokio = { version = "0.2", features = ["time", "macros"] } +tokio = { version = "0.3", features = ["time", "macros"] } diff --git a/linkerd/stack/metrics/Cargo.toml b/linkerd/stack/metrics/Cargo.toml index 06969cfc86..e46d2987e7 100644 --- a/linkerd/stack/metrics/Cargo.toml +++ b/linkerd/stack/metrics/Cargo.toml @@ -8,4 +8,4 @@ publish = false [dependencies] indexmap = "1.0" linkerd2-metrics = { path = "../../metrics" } -tower = { version = "0.3", default-features = false } \ No newline at end of file +tower = { version = "0.4", default-features = false } \ No newline at end of file diff --git a/linkerd/stack/src/switch_ready.rs b/linkerd/stack/src/switch_ready.rs index 21adf26350..8f70843e17 100644 --- a/linkerd/stack/src/switch_ready.rs +++ b/linkerd/stack/src/switch_ready.rs @@ -6,7 +6,7 @@ use std::{ task::{Context, Poll}, time::Duration, }; -use tokio::time::{delay_for, Delay, Instant}; +use tokio::time::{sleep, Instant, Sleep}; use tower::util::Either; /// A service which falls back to a secondary service if the primary service @@ -16,7 +16,7 @@ pub struct SwitchReady { primary: A, secondary: B, switch_after: Duration, - delay: Delay, + delay: Sleep, state: State, } @@ -84,7 +84,7 @@ impl SwitchReady { // the delay is reset whenever the service becomes unready; this // initial one will never actually be used, so it's okay to start it // now. - delay: delay_for(switch_after), + delay: sleep(switch_after), state: State::Primary, } } @@ -162,7 +162,7 @@ impl Clone for SwitchReady { switch_after: self.switch_after, // Reset the state and delay; each clone of the underlying services // may become ready independently (e.g. semaphore). - delay: delay_for(self.switch_after), + delay: sleep(self.switch_after), state: State::Primary, } } @@ -237,7 +237,7 @@ mod tests { assert_pending!(switch.poll_ready()); // Idle out the primary service. - delay_for(dur + Duration::from_millis(1)).await; + sleep(dur + Duration::from_millis(1)).await; assert_pending!(switch.poll_ready()); // The secondary service becomes ready. @@ -266,7 +266,7 @@ mod tests { a_handle.allow(0); assert_pending!(switch.poll_ready()); - delay_for(dur + Duration::from_millis(1)).await; + sleep(dur + Duration::from_millis(1)).await; assert_pending!(switch.poll_ready()); // The secondary service becomes ready. @@ -291,7 +291,7 @@ mod tests { // delay for _half_ the duration. *not* long enough to time out. assert_pending!(switch.poll_ready()); - delay_for(dur / 2).await; + sleep(dur / 2).await; assert_pending!(switch.poll_ready()); // The primary service becomes ready again. @@ -321,7 +321,7 @@ mod tests { assert_pending!(switch.poll_ready()); // delay for _half_ the duration. *not* long enough to time out. - delay_for(dur / 2).await; + sleep(dur / 2).await; assert_pending!(switch.poll_ready()); // The primary service becomes ready. @@ -336,7 +336,7 @@ mod tests { // delay for half the duration again assert_pending!(switch.poll_ready()); - delay_for(dur / 2).await; + sleep(dur / 2).await; assert_pending!(switch.poll_ready()); // The primary service becomes ready. @@ -353,7 +353,7 @@ mod tests { // for longer than the total duration after which we idle out the // primary service, this should be reset every time the primary becomes ready. assert_pending!(switch.poll_ready()); - delay_for(dur / 2).await; + sleep(dur / 2).await; assert_pending!(switch.poll_ready()); // The primary service becomes ready. @@ -386,7 +386,7 @@ mod tests { a_handle.send_error("lol"); assert_ready_err!(switch.poll_ready()); - delay_for(dur + Duration::from_millis(1)).await; + sleep(dur + Duration::from_millis(1)).await; assert_pending!(switch.poll_ready()); b_handle.send_error("lol"); diff --git a/linkerd/stack/tracing/Cargo.toml b/linkerd/stack/tracing/Cargo.toml index c8912d388e..135ab82acf 100644 --- a/linkerd/stack/tracing/Cargo.toml +++ b/linkerd/stack/tracing/Cargo.toml @@ -9,12 +9,12 @@ publish = false futures = "0.3" linkerd2-error = { path = "../../error" } linkerd2-stack = { path = ".." } -tracing = "0.1.19" +tracing = "0.1.22" tracing-futures = { version = "0.2", features = ["std-future"] } pin-project = "0.4" [dependencies.tower] -version = "0.3" +version = "0.4" # disable tower's tracing `log` integration for performance reasons, since we # will consume tower's traces as traces. default-features = false \ No newline at end of file diff --git a/linkerd/timeout/Cargo.toml b/linkerd/timeout/Cargo.toml index c8acb2a4a8..ad2ca6f314 100644 --- a/linkerd/timeout/Cargo.toml +++ b/linkerd/timeout/Cargo.toml @@ -10,12 +10,12 @@ futures = { version = "0.3", features = ["compat"] } linkerd2-error = { path = "../error" } linkerd2-stack = { path = "../stack" } tokio-connect = { git = "https://github.com/carllerche/tokio-connect" } -tracing = "0.1.19" +tracing = "0.1.22" pin-project = "0.4" -tokio = { version = "0.2", features = ["time"] } +tokio = { version = "0.3", features = ["time"] } [dependencies.tower] -version = "0.3" +version = "0.4" # disable tower's tracing `log` integration for performance reasons, since we # will consume tower's traces as traces. default-features = false @@ -27,4 +27,4 @@ features = [ [dev-dependencies] tower-test = "0.3" tokio-test = "0.2" -tokio = { version = "0.2", features = ["macros"] } +tokio = { version = "0.3", features = ["macros"] } diff --git a/linkerd/timeout/src/failfast.rs b/linkerd/timeout/src/failfast.rs index 1aba3e4bb3..3acf3744c8 100644 --- a/linkerd/timeout/src/failfast.rs +++ b/linkerd/timeout/src/failfast.rs @@ -8,7 +8,7 @@ use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use std::time::Duration; -use tokio::time::{self, Delay}; +use tokio::time::{self, Sleep}; use tracing::{debug, trace}; #[derive(Copy, Clone, Debug)] @@ -28,7 +28,7 @@ pub struct FailFastError(()); #[derive(Debug)] enum State { Open, - Waiting(Delay), + Waiting(Sleep), FailFast, } @@ -92,7 +92,7 @@ where Poll::Pending => loop { self.state = match self.state { // The inner service just transitioned to NotReady, so initiate a new timeout. - State::Open => State::Waiting(time::delay_for(self.max_unavailable)), + State::Open => State::Waiting(time::sleep(self.max_unavailable)), // A timeout has been set, so wait for it to complete. State::Waiting(ref mut fut) => { @@ -181,7 +181,7 @@ mod test { // Then we wait for the idle timeout, at which point the service // should start failing fast. - tokio::time::delay_for(max_unavailable + Duration::from_millis(1)).await; + tokio::time::sleep(max_unavailable + Duration::from_millis(1)).await; assert_ready_ok!(service.poll_ready()); let err = service.call(()).await.err().expect("should failfast"); diff --git a/linkerd/trace-context/Cargo.toml b/linkerd/trace-context/Cargo.toml index db8d5358f6..32e0ffc060 100644 --- a/linkerd/trace-context/Cargo.toml +++ b/linkerd/trace-context/Cargo.toml @@ -7,13 +7,13 @@ publish = false [dependencies] base64 = "0.10.1" -bytes = "0.5" +bytes = "0.6" futures = "0.3" hex = "0.3.2" http = "0.2" linkerd2-error = { path = "../error" } linkerd2-stack = { path = "../stack" } -rand = { version = "0.7" } -tower = { version = "0.3", default-features = false, features = ["util"] } +rand = "0.7" +tower = { version = "0.4", default-features = false, features = ["util"] } tracing = "0.1.2" tokio = {version = "0.2", features = ["sync"]} diff --git a/linkerd/tracing/Cargo.toml b/linkerd/tracing/Cargo.toml index cf835b7384..c01d016699 100644 --- a/linkerd/tracing/Cargo.toml +++ b/linkerd/tracing/Cargo.toml @@ -6,15 +6,15 @@ edition = "2018" publish = false [dependencies] -bytes = "0.5" +bytes = "0.6" html-escape = "0.2.5" http = "0.2" -hyper = "0.13" +hyper = "0.14.0-dev" linkerd2-error = { path = "../error" } serde_json = "1" tokio-timer = "0.2" tokio-trace = { git = "https://github.com/hawkw/tokio-trace", rev = "a8240c5cbb4ff981def84920d4087ef23b5edb93", features = ["serde"] } -tracing = "0.1.19" +tracing = "0.1.22" tracing-log = "0.1" [dependencies.tracing-subscriber] diff --git a/linkerd/tracing/src/level.rs b/linkerd/tracing/src/level.rs index e9b7379d8d..d3370fad51 100644 --- a/linkerd/tracing/src/level.rs +++ b/linkerd/tracing/src/level.rs @@ -1,6 +1,5 @@ use crate::{JsonFormatter, PlainFormatter}; -use bytes::buf::Buf; -use hyper::Body; +use hyper::{body::Buf, Body}; use linkerd2_error::Error; use std::{io, str}; use tracing::{trace, warn}; @@ -24,10 +23,10 @@ impl Handle { } &http::Method::PUT => { - let mut body = hyper::body::aggregate(req.into_body()) + let body = hyper::body::aggregate(req.into_body()) .await .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; - match self.set_from(body.to_bytes()) { + match self.set_from(body.bytes()) { Err(error) => { warn!(message = "setting log level failed", %error); Self::rsp(http::StatusCode::BAD_REQUEST, error.to_string()) @@ -52,7 +51,7 @@ impl Handle { .expect("builder with known status code must not fail")) } - fn set_from(&self, bytes: bytes::Bytes) -> Result<(), String> { + fn set_from(&self, bytes: impl AsRef<[u8]>) -> Result<(), String> { let body = str::from_utf8(&bytes.as_ref()).map_err(|e| format!("{}", e))?; trace!(request.body = ?body); self.set_level(body).map_err(|e| format!("{}", e)) diff --git a/linkerd2-proxy/Cargo.toml b/linkerd2-proxy/Cargo.toml index 06dd8ba3b8..cb82adf9e9 100644 --- a/linkerd2-proxy/Cargo.toml +++ b/linkerd2-proxy/Cargo.toml @@ -9,7 +9,7 @@ description = "The main proxy executable" [features] default = ["multicore"] mock-orig-dst = ["linkerd2-app/mock-orig-dst"] -multicore = ["tokio/rt-threaded", "num_cpus"] +multicore = ["tokio/rt-multi-thread", "num_cpus"] [dependencies] futures = { version = "0.3", features = ["compat"] } @@ -17,5 +17,5 @@ mimalloc = { version = "0.1.19", optional = true } num_cpus = { version = "1", optional = true } linkerd2-app = { path = "../linkerd/app" } linkerd2-signal = { path = "../linkerd/signal" } -tokio = { version = "0.2", features = ["rt-core", "time", "io-driver"] } -tracing = "0.1.19" +tokio = { version = "0.3", features = ["rt", "time", "net"] } +tracing = "0.1.22" diff --git a/linkerd2-proxy/src/rt.rs b/linkerd2-proxy/src/rt.rs index a8be15d0be..491d80facb 100644 --- a/linkerd2-proxy/src/rt.rs +++ b/linkerd2-proxy/src/rt.rs @@ -36,20 +36,18 @@ pub(crate) fn build() -> Runtime { // `0` is unexpected, but it's a wild world out there. 0 | 1 => { info!("Using single-threaded proxy runtime"); - Builder::new() + Builder::new_current_thread() .enable_all() .thread_name("proxy") - .basic_scheduler() .build() .expect("failed to build basic runtime!") } num_cpus => { info!(%cores, "Using multi-threaded proxy runtime"); - Builder::new() + Builder::new_multi_thread() .enable_all() .thread_name("proxy") - .threaded_scheduler() - .core_threads(num_cpus) + .worker_threads(num_cpus) .max_threads(num_cpus) .build() .expect("failed to build threaded runtime!") diff --git a/opencensus-proto/Cargo.toml b/opencensus-proto/Cargo.toml index 0b6126c1a1..36228927e6 100644 --- a/opencensus-proto/Cargo.toml +++ b/opencensus-proto/Cargo.toml @@ -11,7 +11,7 @@ Vendored from https://github.com/census-instrumentation/opencensus-proto/. """ [dependencies] -bytes = "0.5" +bytes = "0.6" tonic = { version = "0.3", default-features = false, features = ["prost", "codegen"] } prost = "0.6" prost-types = "0.6"