From 0a4b387d0bf06e251d67b60738c9ecfc58a45cec Mon Sep 17 00:00:00 2001 From: Tom Dyas Date: Sat, 16 Jan 2021 17:19:39 -0800 Subject: [PATCH] tokio 1.x upgrade --- src/rust/engine/Cargo.lock | 630 ++++++++---------- src/rust/engine/Cargo.toml | 12 +- src/rust/engine/async_latch/Cargo.toml | 4 +- src/rust/engine/async_latch/src/lib.rs | 2 +- src/rust/engine/async_latch/src/tests.rs | 9 +- src/rust/engine/async_semaphore/Cargo.toml | 4 +- src/rust/engine/async_semaphore/src/lib.rs | 2 +- src/rust/engine/async_semaphore/src/tests.rs | 38 +- src/rust/engine/async_value/Cargo.toml | 5 +- src/rust/engine/async_value/src/lib.rs | 15 +- src/rust/engine/async_value/src/tests.rs | 6 +- src/rust/engine/concrete_time/Cargo.toml | 4 +- src/rust/engine/fs/Cargo.toml | 4 +- src/rust/engine/fs/brfs/Cargo.toml | 4 +- src/rust/engine/fs/fs_util/Cargo.toml | 6 +- src/rust/engine/fs/store/Cargo.toml | 12 +- src/rust/engine/fs/store/benches/store.rs | 6 +- src/rust/engine/fs/store/src/local_tests.rs | 4 +- src/rust/engine/graph/Cargo.toml | 4 +- src/rust/engine/graph/src/lib.rs | 6 +- src/rust/engine/graph/src/tests.rs | 30 +- src/rust/engine/grpc_util/Cargo.toml | 15 +- src/rust/engine/logging/Cargo.toml | 2 +- src/rust/engine/nailgun/Cargo.toml | 8 +- src/rust/engine/nailgun/src/client.rs | 11 +- src/rust/engine/nailgun/src/server.rs | 4 +- src/rust/engine/nailgun/src/tests.rs | 23 +- src/rust/engine/process_execution/Cargo.toml | 19 +- .../process_execution/bazel_protos/Cargo.toml | 14 +- .../engine/process_execution/src/local.rs | 66 +- .../engine/process_execution/src/remote.rs | 2 +- .../src/remote_cache_tests.rs | 10 +- src/rust/engine/process_executor/Cargo.toml | 4 +- src/rust/engine/sharded_lmdb/Cargo.toml | 2 +- src/rust/engine/src/nodes.rs | 6 +- src/rust/engine/src/scheduler.rs | 12 +- src/rust/engine/stdio/Cargo.toml | 2 +- src/rust/engine/task_executor/Cargo.toml | 2 +- src/rust/engine/task_executor/src/lib.rs | 29 +- src/rust/engine/testutil/Cargo.toml | 4 +- src/rust/engine/testutil/mock/Cargo.toml | 12 +- .../engine/testutil/mock/src/action_cache.rs | 6 +- .../testutil/mock/src/execution_server.rs | 4 +- src/rust/engine/watch/Cargo.toml | 2 +- src/rust/engine/workunit_store/Cargo.toml | 4 +- src/rust/engine/workunit_store/src/lib.rs | 7 +- 46 files changed, 520 insertions(+), 557 deletions(-) diff --git a/src/rust/engine/Cargo.lock b/src/rust/engine/Cargo.lock index 5b43f36f2185..42bbff88d944 100644 --- a/src/rust/engine/Cargo.lock +++ b/src/rust/engine/Cargo.lock @@ -1,5 +1,15 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "adler" version = "0.2.3" @@ -54,7 +64,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", ] @@ -69,6 +89,17 @@ dependencies = [ "syn 1.0.55", ] +[[package]] +name = "async-stream-impl" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3548b8efc9f8e8a5a0a2808c5bd8451a9031b9e5b879a79590304ae928b0a70" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.55", +] + [[package]] name = "async-trait" version = "0.1.42" @@ -128,12 +159,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - [[package]] name = "base64" version = "0.13.0" @@ -145,7 +170,7 @@ name = "bazel_protos" version = "0.0.1" dependencies = [ "build_utils", - "bytes", + "bytes 1.0.1", "copy_dir", "dir-diff", "hashing", @@ -200,7 +225,7 @@ name = "brfs" version = "0.0.1" dependencies = [ "bazel_protos", - "bytes", + "bytes 1.0.1", "clap", "dirs-next", "env_logger", @@ -255,6 +280,12 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" +[[package]] +name = "bytes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" + [[package]] name = "cargo_metadata" version = "0.10.0" @@ -384,9 +415,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.7.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" dependencies = [ "core-foundation-sys", "libc", @@ -394,9 +425,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.7.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" +checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" [[package]] name = "cpuid-bool" @@ -639,7 +670,7 @@ dependencies = [ "async-trait", "async_latch", "async_semaphore", - "bytes", + "bytes 1.0.1", "concrete_time", "cpython", "crossbeam-channel 0.4.4", @@ -674,6 +705,7 @@ dependencies = [ "testutil", "time", "tokio", + "tokio-util", "tryfuture", "ui", "url", @@ -773,7 +805,7 @@ name = "fs" version = "0.0.1" dependencies = [ "async-trait", - "bytes", + "bytes 1.0.1", "dirs-next", "futures", "glob", @@ -793,7 +825,7 @@ name = "fs_util" version = "0.0.1" dependencies = [ "bazel_protos", - "bytes", + "bytes 1.0.1", "clap", "env_logger", "fs", @@ -994,6 +1026,17 @@ dependencies = [ "wasi 0.9.0+wasi-snapshot-preview1", ] +[[package]] +name = "getrandom" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", +] + [[package]] name = "glob" version = "0.2.11" @@ -1033,24 +1076,23 @@ dependencies = [ name = "grpc_util" version = "0.0.1" dependencies = [ - "bytes", + "bytes 1.0.1", "futures", "prost", - "prost-types", "rustls-native-certs", "tokio", "tokio-rustls", - "tokio-util 0.2.0", + "tokio-util", "tonic", ] [[package]] name = "h2" -version = "0.2.7" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" +checksum = "6b67e66362108efccd8ac053abafc8b7a8d86a37e6e48fc4f6f7485eb5e9e6a5" dependencies = [ - "bytes", + "bytes 1.0.1", "fnv", "futures-core", "futures-sink", @@ -1059,7 +1101,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util 0.3.1", + "tokio-util", "tracing", "tracing-futures", ] @@ -1095,7 +1137,7 @@ version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af54a13c410de2b5e2d611475072834b86d7b2f835a2a8f7b1b1248d3e9bfbd8" dependencies = [ - "base64 0.13.0", + "base64", "byteorder", "crossbeam-channel 0.5.0", "flate2", @@ -1133,18 +1175,18 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84129d298a6d57d246960ff8eb831ca4af3f96d29e2e28848dae275408658e26" dependencies = [ - "bytes", + "bytes 0.5.6", "fnv", "itoa", ] [[package]] name = "http-body" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994" dependencies = [ - "bytes", + "bytes 1.0.1", "http", ] @@ -1171,11 +1213,11 @@ dependencies = [ [[package]] name = "hyper" -version = "0.13.10" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" +checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7" dependencies = [ - "bytes", + "bytes 1.0.1", "futures-channel", "futures-core", "futures-util", @@ -1195,11 +1237,10 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.21.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37743cc83e8ee85eacfce90f2f4102030d9ff0a95244098d781e9bee4a90abb6" +checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" dependencies = [ - "bytes", "futures-util", "hyper", "log 0.4.11", @@ -1508,16 +1549,6 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" -[[package]] -name = "mime_guess" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" -dependencies = [ - "mime", - "unicase", -] - [[package]] name = "miniz_oxide" version = "0.4.3" @@ -1548,38 +1579,28 @@ dependencies = [ ] [[package]] -name = "mio-extras" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" -dependencies = [ - "lazycell", - "log 0.4.11", - "mio", - "slab", -] - -[[package]] -name = "mio-named-pipes" -version = "0.1.7" +name = "mio" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" +checksum = "e50ae3f04d169fcc9bde0b547d1c205219b7157e07ded9c5aff03e0637cb3ed7" dependencies = [ + "libc", "log 0.4.11", - "mio", "miow 0.3.6", + "ntapi", "winapi 0.3.9", ] [[package]] -name = "mio-uds" -version = "0.6.8" +name = "mio-extras" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" dependencies = [ - "iovec", - "libc", - "mio", + "lazycell", + "log 0.4.11", + "mio 0.6.23", + "slab", ] [[package]] @@ -1608,9 +1629,9 @@ dependencies = [ name = "mock" version = "0.0.1" dependencies = [ - "async-stream", + "async-stream 0.2.1", "bazel_protos", - "bytes", + "bytes 1.0.1", "futures", "hashing", "hyper", @@ -1634,7 +1655,7 @@ name = "nailgun" version = "0.0.1" dependencies = [ "async_latch", - "bytes", + "bytes 1.0.1", "futures", "log 0.4.11", "nails", @@ -1645,16 +1666,16 @@ dependencies = [ [[package]] name = "nails" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b52b33b5ba2d46687c2d42625e3c26d496e9247a0f430a398c9ce7f167b65df1" +checksum = "9d51ec690ac20be76e55d6939fa43309c3a6e3d5dd1eb2200c8fe27a087d5c92" dependencies = [ "byteorder", - "bytes", + "bytes 1.0.1", "futures", "log 0.4.11", "tokio", - "tokio-util 0.2.0", + "tokio-util", ] [[package]] @@ -1693,12 +1714,21 @@ dependencies = [ "fsevent-sys", "inotify", "libc", - "mio", + "mio 0.6.23", "mio-extras", "walkdir 2.3.1", "winapi 0.3.9", ] +[[package]] +name = "ntapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "num" version = "0.1.42" @@ -1855,6 +1885,29 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "ouroboros" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069fb33e127cabdc8ad6a287eed9719b85c612d36199777f6dc41ad91f7be41a" +dependencies = [ + "ouroboros_macro", + "stable_deref_trait", +] + +[[package]] +name = "ouroboros_macro" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad938cc920f299d6dce91e43d3ce316e785f4aa4bc4243555634dc2967098fc6" +dependencies = [ + "Inflector", + "proc-macro-error", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.55", +] + [[package]] name = "parking_lot" version = "0.11.1" @@ -1965,12 +2018,6 @@ dependencies = [ "syn 1.0.55", ] -[[package]] -name = "pin-project-lite" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" - [[package]] name = "pin-project-lite" version = "0.2.0" @@ -2078,7 +2125,7 @@ dependencies = [ "async_semaphore", "bazel_protos", "bincode", - "bytes", + "bytes 1.0.1", "concrete_time", "derivative", "double-checked-cell-async", @@ -2093,6 +2140,7 @@ dependencies = [ "maplit", "mock", "nails", + "ouroboros", "parking_lot", "prost", "prost-types", @@ -2109,7 +2157,7 @@ dependencies = [ "testutil", "tokio", "tokio-rustls", - "tokio-util 0.2.0", + "tokio-util", "tonic", "tryfuture", "uname", @@ -2142,19 +2190,21 @@ dependencies = [ [[package]] name = "prost" -version = "0.6.1" -source = "git+https://github.com/danburkert/prost?rev=a1cccbcee343e2c444e1cd2738c7fba2599fc391#a1cccbcee343e2c444e1cd2738c7fba2599fc391" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" dependencies = [ - "bytes", - "prost-derive 0.6.1 (git+https://github.com/danburkert/prost?rev=a1cccbcee343e2c444e1cd2738c7fba2599fc391)", + "bytes 1.0.1", + "prost-derive", ] [[package]] name = "prost-build" -version = "0.6.1" -source = "git+https://github.com/danburkert/prost?rev=a1cccbcee343e2c444e1cd2738c7fba2599fc391#a1cccbcee343e2c444e1cd2738c7fba2599fc391" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3" dependencies = [ - "bytes", + "bytes 1.0.1", "heck", "itertools 0.9.0", "log 0.4.11", @@ -2168,21 +2218,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" -dependencies = [ - "anyhow", - "itertools 0.8.2", - "proc-macro2 1.0.24", - "quote 1.0.8", - "syn 1.0.55", -] - -[[package]] -name = "prost-derive" -version = "0.6.1" -source = "git+https://github.com/danburkert/prost?rev=a1cccbcee343e2c444e1cd2738c7fba2599fc391#a1cccbcee343e2c444e1cd2738c7fba2599fc391" +checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" dependencies = [ "anyhow", "itertools 0.9.0", @@ -2193,10 +2231,11 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.6.1" -source = "git+https://github.com/danburkert/prost?rev=a1cccbcee343e2c444e1cd2738c7fba2599fc391#a1cccbcee343e2c444e1cd2738c7fba2599fc391" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" dependencies = [ - "bytes", + "bytes 1.0.1", "prost", ] @@ -2206,7 +2245,7 @@ version = "2.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da78e04bc0e40f36df43ecc6575e4f4b180e8156c4efd73f13d5619479b05696" dependencies = [ - "bytes", + "bytes 0.5.6", ] [[package]] @@ -2276,7 +2315,7 @@ dependencies = [ "rand_isaac", "rand_jitter", "rand_os", - "rand_pcg 0.1.2", + "rand_pcg", "rand_xorshift", "winapi 0.3.9", ] @@ -2287,12 +2326,23 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", + "getrandom 0.1.15", "libc", "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc 0.2.0", - "rand_pcg 0.2.1", +] + +[[package]] +name = "rand" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18519b42a40024d661e1714153e9ad0c3de27cd495760ceb09710920f1098b1e" +dependencies = [ + "libc", + "rand_chacha 0.3.0", + "rand_core 0.6.1", + "rand_hc 0.3.0", ] [[package]] @@ -2315,6 +2365,16 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.1", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -2336,7 +2396,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.15", +] + +[[package]] +name = "rand_core" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" +dependencies = [ + "getrandom 0.2.1", ] [[package]] @@ -2357,6 +2426,15 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +dependencies = [ + "rand_core 0.6.1", +] + [[package]] name = "rand_isaac" version = "0.1.1" @@ -2401,15 +2479,6 @@ dependencies = [ "rand_core 0.4.2", ] -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", -] - [[package]] name = "rand_xorshift" version = "0.1.1" @@ -2465,7 +2534,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" dependencies = [ - "getrandom", + "getrandom 0.1.15", "redox_syscall", ] @@ -2507,12 +2576,12 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.10.10" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c" +checksum = "0460542b551950620a3648c6aa23318ac6b3cd779114bd873209e6e8b5eb1c34" dependencies = [ - "base64 0.13.0", - "bytes", + "base64", + "bytes 1.0.1", "encoding_rs", "futures-core", "futures-util", @@ -2525,9 +2594,8 @@ dependencies = [ "lazy_static", "log 0.4.11", "mime", - "mime_guess", "percent-encoding", - "pin-project-lite 0.2.0", + "pin-project-lite", "rustls", "serde", "serde_urlencoded", @@ -2593,11 +2661,11 @@ dependencies = [ [[package]] name = "rustls" -version = "0.18.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d1126dcf58e93cee7d098dbda643b5f92ed724f1f6a63007c1116eed6700c81" +checksum = "064fd21ff87c6e87ed4506e68beb42459caa4a0e2eb144932e6776768556980b" dependencies = [ - "base64 0.12.3", + "base64", "log 0.4.11", "ring", "sct", @@ -2606,9 +2674,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629d439a7672da82dd955498445e496ee2096fe2117b9f796558a43fdb9e59b8" +checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092" dependencies = [ "openssl-probe", "rustls", @@ -2659,9 +2727,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad502866817f0575705bd7be36e2b2535cc33262d493aa733a2ec862baa2bc2b" +checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" dependencies = [ "bitflags", "core-foundation", @@ -2672,9 +2740,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51ceb04988b17b6d1dcd555390fa822ca5637b4a14e1f5099f13d351bed4d6c7" +checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" dependencies = [ "core-foundation-sys", "libc", @@ -2775,7 +2843,7 @@ dependencies = [ name = "sharded_lmdb" version = "0.0.1" dependencies = [ - "bytes", + "bytes 1.0.1", "fs", "futures", "hashing", @@ -2853,6 +2921,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -2872,10 +2946,10 @@ dependencies = [ name = "store" version = "0.1.0" dependencies = [ - "async-stream", + "async-stream 0.2.1", "async-trait", "bazel_protos", - "bytes", + "bytes 1.0.1", "concrete_time", "criterion", "fs", @@ -3055,9 +3129,9 @@ dependencies = [ name = "testutil" version = "0.0.1" dependencies = [ - "async-stream", + "async-stream 0.2.1", "bazel_protos", - "bytes", + "bytes 1.0.1", "fs", "grpc_util", "hashing", @@ -3073,6 +3147,26 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "thiserror" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.55", +] + [[package]] name = "thread-scoped" version = "1.0.2" @@ -3126,33 +3220,28 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "0.2.25" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" +checksum = "134af885d758d645f0f0505c9a8b3f9bf8a348fd822e112ab5248138348f1722" dependencies = [ - "bytes", - "fnv", - "futures-core", - "iovec", - "lazy_static", + "autocfg 1.0.1", + "bytes 1.0.1", "libc", "memchr", - "mio", - "mio-named-pipes", - "mio-uds", + "mio 0.7.7", "num_cpus", - "pin-project-lite 0.1.11", + "once_cell", + "pin-project-lite", "signal-hook-registry", - "slab", "tokio-macros", "winapi 0.3.9", ] [[package]] name = "tokio-macros" -version = "0.2.6" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" +checksum = "caf7b11a536f46a809a8a9f0bb4237020f70ecbf115b842360afb127ea2fda57" dependencies = [ "proc-macro2 1.0.24", "quote 1.0.8", @@ -3161,41 +3250,37 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.14.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12831b255bcfa39dc0436b01e19fea231a37db570686c06ee72c423479f889a" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ - "futures-core", "rustls", "tokio", "webpki", ] [[package]] -name = "tokio-util" -version = "0.2.0" +name = "tokio-stream" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" +checksum = "76066865172052eb8796c686f0b441a93df8b08d40a950b062ffb9a426f00edd" dependencies = [ - "bytes", "futures-core", - "futures-sink", - "log 0.4.11", - "pin-project-lite 0.1.11", + "pin-project-lite", "tokio", ] [[package]] name = "tokio-util" -version = "0.3.1" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +checksum = "5143d049e85af7fbc36f5454d990e62c2df705b3589f123b71f441b6b59f443f" dependencies = [ - "bytes", + "bytes 1.0.1", "futures-core", "futures-sink", "log 0.4.11", - "pin-project-lite 0.1.11", + "pin-project-lite", "tokio", ] @@ -3210,31 +3295,30 @@ dependencies = [ [[package]] name = "tonic" -version = "0.3.1" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74a5d6e7439ecf910463667080de772a9c7ddf26bc9fb4f3252ac3862e43337d" +checksum = "91491e5f15431f2189ec8c1f9dcbadac949450399c22c912ceae9570eb472f61" dependencies = [ - "async-stream", + "async-stream 0.3.0", "async-trait", - "base64 0.12.3", - "bytes", + "base64", + "bytes 1.0.1", "futures-core", "futures-util", + "h2", "http", "http-body", "hyper", "percent-encoding", - "pin-project 0.4.27", + "pin-project 1.0.2", "prost", - "prost-derive 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "prost-derive", "rustls-native-certs", "tokio", "tokio-rustls", - "tokio-util 0.3.1", + "tokio-stream", + "tokio-util", "tower", - "tower-balance", - "tower-load", - "tower-make", "tower-service", "tracing", "tracing-futures", @@ -3242,9 +3326,9 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19970cf58f3acc820962be74c4021b8bbc8e8a1c4e3a02095d0aa60cde5f3633" +checksum = "c1e8546fd40d56d28089835c0a81bb396848103b00f888aea42d46eb5974df07" dependencies = [ "proc-macro2 1.0.24", "prost-build", @@ -3254,151 +3338,29 @@ dependencies = [ [[package]] name = "tower" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3169017c090b7a28fce80abaad0ab4f5566423677c9331bb320af7e49cfe62" -dependencies = [ - "futures-core", - "tower-buffer", - "tower-discover", - "tower-layer", - "tower-limit", - "tower-load-shed", - "tower-retry", - "tower-service", - "tower-timeout", - "tower-util", -] - -[[package]] -name = "tower-balance" -version = "0.3.0" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a792277613b7052448851efcf98a2c433e6f1d01460832dc60bef676bc275d4c" +checksum = "f715efe02c0862926eb463e49368d38ddb119383475686178e32e26d15d06a66" dependencies = [ "futures-core", "futures-util", "indexmap", - "pin-project 0.4.27", - "rand 0.7.3", + "pin-project 1.0.2", + "rand 0.8.2", "slab", "tokio", - "tower-discover", + "tokio-stream", + "tokio-util", "tower-layer", - "tower-load", - "tower-make", - "tower-ready-cache", "tower-service", "tracing", ] -[[package]] -name = "tower-buffer" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4887dc2a65d464c8b9b66e0e4d51c2fd6cf5b3373afc72805b0a60bce00446a" -dependencies = [ - "futures-core", - "pin-project 0.4.27", - "tokio", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-discover" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6b5000c3c54d269cc695dff28136bb33d08cbf1df2c48129e143ab65bf3c2a" -dependencies = [ - "futures-core", - "pin-project 0.4.27", - "tower-service", -] - [[package]] name = "tower-layer" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35d656f2638b288b33495d1053ea74c40dc05ec0b92084dd71ca5566c4ed1dc" - -[[package]] -name = "tower-limit" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92c3040c5dbed68abffaa0d4517ac1a454cd741044f33ab0eefab6b8d1361404" -dependencies = [ - "futures-core", - "pin-project 0.4.27", - "tokio", - "tower-layer", - "tower-load", - "tower-service", -] - -[[package]] -name = "tower-load" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cc79fc3afd07492b7966d7efa7c6c50f8ed58d768a6075dd7ae6591c5d2017b" -dependencies = [ - "futures-core", - "log 0.4.11", - "pin-project 0.4.27", - "tokio", - "tower-discover", - "tower-service", -] - -[[package]] -name = "tower-load-shed" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f021e23900173dc315feb4b6922510dae3e79c689b74c089112066c11f0ae4e" -dependencies = [ - "futures-core", - "pin-project 0.4.27", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-make" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce50370d644a0364bf4877ffd4f76404156a248d104e2cc234cd391ea5cdc965" -dependencies = [ - "tokio", - "tower-service", -] - -[[package]] -name = "tower-ready-cache" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eabb6620e5481267e2ec832c780b31cad0c15dcb14ed825df5076b26b591e1f" -dependencies = [ - "futures-core", - "futures-util", - "indexmap", - "log 0.4.11", - "tokio", - "tower-service", -] - -[[package]] -name = "tower-retry" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6727956aaa2f8957d4d9232b308fe8e4e65d99db30f42b225646e86c9b6a952" -dependencies = [ - "futures-core", - "pin-project 0.4.27", - "tokio", - "tower-layer", - "tower-service", -] +checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" [[package]] name = "tower-service" @@ -3406,30 +3368,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" -[[package]] -name = "tower-timeout" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "127b8924b357be938823eaaec0608c482d40add25609481027b96198b2e4b31e" -dependencies = [ - "pin-project 0.4.27", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-util" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1093c19826d33807c72511e68f73b4a0469a3f22c2bd5f7d5212178b4b89674" -dependencies = [ - "futures-core", - "futures-util", - "pin-project 0.4.27", - "tower-service", -] - [[package]] name = "tracing" version = "0.1.22" @@ -3438,7 +3376,7 @@ checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3" dependencies = [ "cfg-if 1.0.0", "log 0.4.11", - "pin-project-lite 0.2.0", + "pin-project-lite", "tracing-attributes", "tracing-core", ] @@ -3515,15 +3453,6 @@ dependencies = [ "libc", ] -[[package]] -name = "unicase" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" version = "0.3.4" @@ -3770,20 +3699,21 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f" +checksum = "82015b7e0b8bad8185994674a13a93306bea76cf5a16c5a181382fd3a5ec2376" dependencies = [ "webpki", ] [[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]] @@ -3842,7 +3772,7 @@ dependencies = [ name = "workunit_store" version = "0.0.1" dependencies = [ - "bytes", + "bytes 1.0.1", "concrete_time", "hashing", "hdrhistogram", diff --git a/src/rust/engine/Cargo.toml b/src/rust/engine/Cargo.toml index 194c2b3d75ff..9179f7e4d249 100644 --- a/src/rust/engine/Cargo.toml +++ b/src/rust/engine/Cargo.toml @@ -100,7 +100,7 @@ default = [] async_latch = { path = "async_latch" } async_semaphore = { path = "async_semaphore" } async-trait = "0.1" -bytes = "0.5" +bytes = "1.0" concrete_time = { path = "concrete_time" } cpython = "0.5" crossbeam-channel = "0.4" @@ -122,7 +122,7 @@ parking_lot = "0.11" process_execution = { path = "process_execution" } rand = "0.6" regex = "1" -reqwest = { version = "0.10", default_features = false, features = ["stream", "rustls-tls"] } +reqwest = { version = "0.11", default_features = false, features = ["stream", "rustls-tls"] } rule_graph = { path = "rule_graph" } sharded_lmdb = { path = "sharded_lmdb" } smallvec = "0.6" @@ -132,7 +132,8 @@ task_executor = { path = "task_executor" } tempfile = "3" testutil_mock = { package = "mock", path = "testutil/mock" } time = "0.1.40" -tokio = { version = "0.2.23", features = ["macros", "rt-threaded"] } +tokio = { version = "^1.4", features = ["macros", "rt-multi-thread"] } +tokio-util = { version = "0.6", features = ["io"] } tryfuture = { path = "tryfuture" } ui = { path = "ui" } url = "2.1" @@ -146,10 +147,5 @@ fs = { path = "./fs" } env_logger = "0.5.4" [patch.crates-io] -# Patch all transitive uses of Prost to refer to the version with `Bytes` support. -# Specifically, this Prost commit: https://github.com/danburkert/prost/commit/a1cccbcee343e2c444e1cd2738c7fba2599fc391 -prost = { git = "https://github.com/danburkert/prost", rev = "a1cccbcee343e2c444e1cd2738c7fba2599fc391" } -prost-build = { git = "https://github.com/danburkert/prost", rev = "a1cccbcee343e2c444e1cd2738c7fba2599fc391" } -prost-types = { git = "https://github.com/danburkert/prost", rev = "a1cccbcee343e2c444e1cd2738c7fba2599fc391" } # TODO: Posted as https://github.com/mitsuhiko/console/pull/93. console = { git = "https://github.com/pantsbuild/console", rev = "b6e9aa7ce734517691934d558d79a459609633db" } diff --git a/src/rust/engine/async_latch/Cargo.toml b/src/rust/engine/async_latch/Cargo.toml index d9b7ed2af78d..dd319b1f9a42 100644 --- a/src/rust/engine/async_latch/Cargo.toml +++ b/src/rust/engine/async_latch/Cargo.toml @@ -7,7 +7,7 @@ publish = false [dependencies] parking_lot = "0.11" -tokio = { version = "0.2.23", features = ["sync"] } +tokio = { version = "^1.4", features = ["sync"] } [dev-dependencies] -tokio = { version = "0.2.23", features = ["macros"] } +tokio = { version = "^1.4", features = ["rt", "macros", "time"] } diff --git a/src/rust/engine/async_latch/src/lib.rs b/src/rust/engine/async_latch/src/lib.rs index 59e87e0347d8..9267250ba175 100644 --- a/src/rust/engine/async_latch/src/lib.rs +++ b/src/rust/engine/async_latch/src/lib.rs @@ -72,7 +72,7 @@ impl AsyncLatch { // To see whether the latch is triggered, we clone the receiver, and then wait for our clone to // return None, indicating that the Sender has been dropped. let mut receiver = self.receiver.clone(); - while receiver.recv().await.is_some() {} + while receiver.changed().await.is_ok() {} } /// diff --git a/src/rust/engine/async_latch/src/tests.rs b/src/rust/engine/async_latch/src/tests.rs index f041b078114c..34e16c8473e5 100644 --- a/src/rust/engine/async_latch/src/tests.rs +++ b/src/rust/engine/async_latch/src/tests.rs @@ -1,9 +1,8 @@ -use crate::AsyncLatch; - use std::time::Duration; -use tokio; -use tokio::time::delay_for; +use tokio::time::sleep; + +use crate::AsyncLatch; #[tokio::test] async fn basic() { @@ -16,7 +15,7 @@ async fn basic() { // Ensure that `triggered` doesn't return until `trigger` has been called. tokio::select! { - _ = delay_for(Duration::from_secs(1)) => {}, + _ = sleep(Duration::from_secs(1)) => {}, _ = &mut join => { panic!("Background task should have continued to wait.") } } latch.trigger(); diff --git a/src/rust/engine/async_semaphore/Cargo.toml b/src/rust/engine/async_semaphore/Cargo.toml index a2ffd7336f42..e478d157fef4 100644 --- a/src/rust/engine/async_semaphore/Cargo.toml +++ b/src/rust/engine/async_semaphore/Cargo.toml @@ -7,8 +7,8 @@ publish = false [dependencies] parking_lot = "0.11" -tokio = { version = "0.2.23", features = ["sync"] } +tokio = { version = "^1.4", features = ["sync"] } [dev-dependencies] futures = "0.3" -tokio = { version = "0.2.23", features = ["rt-core", "macros", "time"] } +tokio = { version = "^1.4", features = ["rt", "macros", "time"] } diff --git a/src/rust/engine/async_semaphore/src/lib.rs b/src/rust/engine/async_semaphore/src/lib.rs index 4486f1d5c3cc..2805d68d1b10 100644 --- a/src/rust/engine/async_semaphore/src/lib.rs +++ b/src/rust/engine/async_semaphore/src/lib.rs @@ -78,7 +78,7 @@ impl AsyncSemaphore { } async fn acquire(&self) -> Permit<'_> { - let permit = self.inner.sema.acquire().await; + let permit = self.inner.sema.acquire().await.expect("semaphore closed"); let id = { let mut available_ids = self.inner.available_ids.lock(); available_ids diff --git a/src/rust/engine/async_semaphore/src/tests.rs b/src/rust/engine/async_semaphore/src/tests.rs index 5e22539898c4..f7ecac87313c 100644 --- a/src/rust/engine/async_semaphore/src/tests.rs +++ b/src/rust/engine/async_semaphore/src/tests.rs @@ -1,12 +1,10 @@ -use crate::AsyncSemaphore; - use std::time::Duration; use futures::channel::oneshot; use futures::future::{self, FutureExt}; +use tokio::time::{sleep, timeout}; -use tokio; -use tokio::time::{delay_for, timeout}; +use crate::AsyncSemaphore; #[tokio::test] async fn acquire_and_release() { @@ -28,27 +26,27 @@ async fn correct_semaphore_slot_ids() { //Process 1 tokio::spawn(sema.clone().with_acquired(move |id| async move { tx1.send(id).unwrap(); - delay_for(2 * scale).await; + sleep(2 * scale).await; future::ready(()) })); //Process 2 tokio::spawn(sema.clone().with_acquired(move |id| async move { - delay_for(1 * scale).await; + sleep(scale).await; tx2.send(id).unwrap(); future::ready(()) })); //Process 3 tokio::spawn(sema.clone().with_acquired(move |id| async move { - delay_for(1 * scale).await; + sleep(scale).await; tx3.send(id).unwrap(); future::ready(()) })); - delay_for(5 * scale).await; + sleep(5 * scale).await; //Process 4 tokio::spawn(sema.clone().with_acquired(move |id| async move { - delay_for(1 * scale).await; + sleep(scale).await; tx4.send(id).unwrap(); future::ready(()) })); @@ -82,49 +80,49 @@ async fn correct_semaphore_slot_ids_2() { tokio::spawn(sema.clone().with_acquired(move |id| async move { println!("Exec process 1"); tx1.send(id).unwrap(); - delay_for(Duration::from_millis(20)).await; + sleep(Duration::from_millis(20)).await; future::ready(()) })); println!("Spawning process 2"); tokio::spawn(sema.clone().with_acquired(move |id| async move { println!("Exec process 2"); tx2.send(id).unwrap(); - delay_for(Duration::from_millis(20)).await; + sleep(Duration::from_millis(20)).await; future::ready(()) })); println!("Spawning process 3"); tokio::spawn(sema.clone().with_acquired(move |id| async move { println!("Exec process 3"); tx3.send(id).unwrap(); - delay_for(Duration::from_millis(20)).await; + sleep(Duration::from_millis(20)).await; future::ready(()) })); println!("Spawning process 4"); tokio::spawn(sema.clone().with_acquired(move |id| async move { println!("Exec process 4"); tx4.send(id).unwrap(); - delay_for(Duration::from_millis(20)).await; + sleep(Duration::from_millis(20)).await; future::ready(()) })); println!("Spawning process 5"); tokio::spawn(sema.clone().with_acquired(move |id| async move { println!("Exec process 5"); tx5.send(id).unwrap(); - delay_for(Duration::from_millis(20)).await; + sleep(Duration::from_millis(20)).await; future::ready(()) })); println!("Spawning process 6"); tokio::spawn(sema.clone().with_acquired(move |id| async move { println!("Exec process 6"); tx6.send(id).unwrap(); - delay_for(Duration::from_millis(20)).await; + sleep(Duration::from_millis(20)).await; future::ready(()) })); println!("Spawning process 7"); tokio::spawn(sema.clone().with_acquired(move |id| async move { println!("Exec process 7"); tx7.send(id).unwrap(); - delay_for(Duration::from_millis(20)).await; + sleep(Duration::from_millis(20)).await; future::ready(()) })); @@ -176,7 +174,7 @@ async fn at_most_n_acquisitions() { // thread2 should not signal until we unblock thread1. let acquired_thread2 = - match future::select(delay_for(Duration::from_millis(100)), acquired_thread2).await { + match future::select(sleep(Duration::from_millis(100)).boxed(), acquired_thread2).await { future::Either::Left((_, acquired_thread2)) => acquired_thread2, future::Either::Right(_) => { panic!("thread2 should not have acquired while thread1 was holding.") @@ -238,7 +236,7 @@ async fn drop_while_waiting() { // thread2 will wait for a little while, but then drop its PermitFuture to give up on waiting. tokio::spawn(async move { let permit_future = handle2.acquire().boxed(); - let delay_future = delay_for(Duration::from_millis(100)); + let delay_future = sleep(Duration::from_millis(100)).boxed(); let raced_result = future::select(delay_future, permit_future).await; // We expect to have timed out, because the other Future will not resolve until asked. match raced_result { @@ -296,7 +294,7 @@ async fn dropped_future_is_removed_from_queue() { } let waiter = handle2.with_acquired(|_id| future::ready(())); let join_handle2 = tokio::spawn(async move { - match future::select(delay_for(Duration::from_millis(100)), waiter.boxed()).await { + match future::select(sleep(Duration::from_millis(100)).boxed(), waiter.boxed()).await { future::Either::Left(((), waiter_future)) => { tx_thread2.send(()).unwrap(); rx_thread2.await.unwrap(); @@ -304,7 +302,7 @@ async fn dropped_future_is_removed_from_queue() { () } future::Either::Right(_) => { - panic!("The delay_for result should always be ready first!"); + panic!("The sleep result should always be ready first!"); } } }); diff --git a/src/rust/engine/async_value/Cargo.toml b/src/rust/engine/async_value/Cargo.toml index 2f53b70c7891..02a050002a33 100644 --- a/src/rust/engine/async_value/Cargo.toml +++ b/src/rust/engine/async_value/Cargo.toml @@ -7,4 +7,7 @@ publish = false [dependencies] futures = "0.3" -tokio = { version = "0.2.23", features = ["sync"] } +tokio = { version = "^1.4", features = ["macros", "sync"] } + +[dev-dependencies] +tokio = { version = "^1.4", features = ["macros", "rt", "sync", "time"] } diff --git a/src/rust/engine/async_value/src/lib.rs b/src/rust/engine/async_value/src/lib.rs index 3cf0fd143cae..03047294eba8 100644 --- a/src/rust/engine/async_value/src/lib.rs +++ b/src/rust/engine/async_value/src/lib.rs @@ -91,13 +91,12 @@ impl AsyncValueReceiver { pub async fn recv(&self) -> Option { let mut item_receiver = (*self.item_receiver).clone(); loop { - match item_receiver.recv().await { - Some(None) => { - // Observing the initial value of the channel. - continue; - } - Some(t) => break t, - None => break None, + if let Some(ref value) = *item_receiver.borrow() { + return Some(value.clone()); + } + + if item_receiver.changed().await.is_err() { + return None; } } } @@ -110,7 +109,7 @@ pub struct AsyncValueSender { impl AsyncValueSender { pub fn send(self, item: T) { - let _ = self.item_sender.broadcast(Some(item)); + let _ = self.item_sender.send(Some(item)); } pub async fn closed(&mut self) { diff --git a/src/rust/engine/async_value/src/tests.rs b/src/rust/engine/async_value/src/tests.rs index 6ee25d78f300..670e2816eec0 100644 --- a/src/rust/engine/async_value/src/tests.rs +++ b/src/rust/engine/async_value/src/tests.rs @@ -3,7 +3,7 @@ use crate::AsyncValue; use std::time::Duration; use tokio; -use tokio::time::delay_for; +use tokio::time::sleep; #[tokio::test] async fn send() { @@ -21,7 +21,7 @@ async fn cancel_explicit() { // Ensure that a value is not received. tokio::select! { - _ = delay_for(Duration::from_secs(1)) => {}, + _ = sleep(Duration::from_secs(1)) => {}, _ = receiver.recv() => { panic!("Should have continued to wait.") } } @@ -39,7 +39,7 @@ async fn cancel_implicit() { // Ensure that a value is not received. tokio::select! { - _ = delay_for(Duration::from_secs(1)) => {}, + _ = sleep(Duration::from_secs(1)) => {}, _ = receiver.recv() => { panic!("Should have continued to wait.") } } diff --git a/src/rust/engine/concrete_time/Cargo.toml b/src/rust/engine/concrete_time/Cargo.toml index 4bc4e288b1c1..7be81a918880 100644 --- a/src/rust/engine/concrete_time/Cargo.toml +++ b/src/rust/engine/concrete_time/Cargo.toml @@ -6,8 +6,8 @@ name = "concrete_time" publish = false [dependencies] -prost = { git = "https://github.com/danburkert/prost", rev = "a1cccbcee343e2c444e1cd2738c7fba2599fc391" } -prost-types = "0.6" +prost = "0.7" +prost-types = "0.7" serde_derive = "1.0.98" serde = "1.0.98" log = "0.4" diff --git a/src/rust/engine/fs/Cargo.toml b/src/rust/engine/fs/Cargo.toml index 631c633f6e6c..577f0e437c87 100644 --- a/src/rust/engine/fs/Cargo.toml +++ b/src/rust/engine/fs/Cargo.toml @@ -7,7 +7,7 @@ publish = false [dependencies] async-trait = "0.1" -bytes = "0.5" +bytes = "1.0" dirs-next = "2" futures = "0.3" glob = "0.2.11" @@ -21,4 +21,4 @@ task_executor = { path = "../task_executor" } [dev-dependencies] tempfile = "3" testutil = { path = "../testutil" } -tokio = { version = "0.2.23", features = ["rt-core", "macros"] } +tokio = { version = "^1.4", features = ["rt", "macros"] } diff --git a/src/rust/engine/fs/brfs/Cargo.toml b/src/rust/engine/fs/brfs/Cargo.toml index ca7944475db6..0c4185f05c50 100644 --- a/src/rust/engine/fs/brfs/Cargo.toml +++ b/src/rust/engine/fs/brfs/Cargo.toml @@ -21,10 +21,10 @@ protobuf = { version = "2.0.6", features = ["with-bytes"] } store = { path = "../store" } task_executor = { path = "../../task_executor" } time = "0.1.39" -tokio = { version = "0.2.23", features = ["rt-threaded", "macros", "signal", "stream"] } +tokio = { version = "^1.4", features = ["rt-multi-thread", "macros", "signal"] } workunit_store = { path = "../../workunit_store" } [dev-dependencies] -bytes = "0.5" +bytes = "1.0" tempfile = "3" testutil = { path = "../../testutil" } diff --git a/src/rust/engine/fs/fs_util/Cargo.toml b/src/rust/engine/fs/fs_util/Cargo.toml index 78ee25f58494..47e15d23485e 100644 --- a/src/rust/engine/fs/fs_util/Cargo.toml +++ b/src/rust/engine/fs/fs_util/Cargo.toml @@ -7,7 +7,7 @@ publish = false [dependencies] bazel_protos = { path = "../../process_execution/bazel_protos" } -bytes = "0.5" +bytes = "1.0" clap = "2" env_logger = "0.5.4" grpc_util = { path = "../../grpc_util" } @@ -15,12 +15,12 @@ fs = { path = ".." } futures = "0.3" hashing = { path = "../../hashing" } parking_lot = "0.11" -prost = { git = "https://github.com/danburkert/prost", rev = "a1cccbcee343e2c444e1cd2738c7fba2599fc391" } +prost = "0.7" rand = "0.6" serde = "1.0" serde_json = "1.0" serde_derive = "1.0" store = { path = "../store" } task_executor = { path = "../../task_executor" } -tokio = { version = "0.2.23", features = ["rt-threaded", "macros"] } +tokio = { version = "^1.4", features = ["rt-multi-thread", "macros"] } workunit_store = { path = "../../workunit_store" } diff --git a/src/rust/engine/fs/store/Cargo.toml b/src/rust/engine/fs/store/Cargo.toml index c52b40fe1155..2d4cdc3d375e 100644 --- a/src/rust/engine/fs/store/Cargo.toml +++ b/src/rust/engine/fs/store/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" async-stream = "0.2" async-trait = "0.1" bazel_protos = { path = "../../process_execution/bazel_protos" } -bytes = "0.5" +bytes = "1.0" concrete_time = { path = "../../concrete_time" } grpc_util = { path = "../../grpc_util" } fs = { path = ".." } @@ -20,15 +20,15 @@ itertools = "0.7.2" lmdb = { git = "https://github.com/pantsbuild/lmdb-rs.git", rev = "06bdfbfc6348f6804127176e561843f214fc17f8" } log = "0.4" parking_lot = "0.11" -prost = { git = "https://github.com/danburkert/prost", rev = "a1cccbcee343e2c444e1cd2738c7fba2599fc391" } -prost-types = "0.6" +prost = "0.7" +prost-types = "0.7" serde = "1.0" serde_derive = "1.0" sharded_lmdb = { path = "../../sharded_lmdb" } task_executor = { path = "../../task_executor" } tempfile = "3" -tokio-rustls = "0.14" -tonic = { version = "0.3", features = ["transport", "codegen", "tls", "tls-roots", "prost"] } +tokio-rustls = "0.22" +tonic = { version = "0.4", features = ["transport", "codegen", "tls", "tls-roots", "prost"] } tryfuture = { path = "../../tryfuture" } uuid = { version = "0.7.1", features = ["v4"] } workunit_store = {path = "../../workunit_store" } @@ -39,7 +39,7 @@ maplit = "*" mock = { path = "../../testutil/mock" } num_cpus = "1" testutil = { path = "../../testutil" } -tokio = { version = "0.2.23", features = ["rt-core", "macros"] } +tokio = { version = "^1.4", features = ["rt", "macros"] } walkdir = "2" [[bench]] diff --git a/src/rust/engine/fs/store/benches/store.rs b/src/rust/engine/fs/store/benches/store.rs index 8fe6e880297a..701bb874bbc7 100644 --- a/src/rust/engine/fs/store/benches/store.rs +++ b/src/rust/engine/fs/store/benches/store.rs @@ -53,7 +53,7 @@ pub fn criterion_benchmark_materialize(c: &mut Criterion) { // Create an executor, store containing the stuff to materialize, and a digest for the stuff. // To avoid benchmarking the deleting of things, we create a parent temporary directory (which // will be deleted at the end of the benchmark) and then skip deletion of the per-run directories. - let executor = Executor::global(num_cpus::get(), num_cpus::get() * 4); + let executor = Executor::global(num_cpus::get(), num_cpus::get() * 4).unwrap(); let (store, _tempdir, digest) = large_snapshot(&executor, 100); let parent_dest = TempDir::new().unwrap(); let parent_dest_path = parent_dest.path(); @@ -77,7 +77,7 @@ pub fn criterion_benchmark_materialize(c: &mut Criterion) { } pub fn criterion_benchmark_subset_wildcard(c: &mut Criterion) { - let executor = Executor::global(num_cpus::get(), num_cpus::get() * 4); + let executor = Executor::global(num_cpus::get(), num_cpus::get() * 4).unwrap(); // NB: We use a much larger snapshot size compared to the materialize benchmark! let (store, _tempdir, digest) = large_snapshot(&executor, 1000); @@ -105,7 +105,7 @@ pub fn criterion_benchmark_subset_wildcard(c: &mut Criterion) { } pub fn criterion_benchmark_merge(c: &mut Criterion) { - let executor = Executor::global(num_cpus::get(), num_cpus::get() * 4); + let executor = Executor::global(num_cpus::get(), num_cpus::get() * 4).unwrap(); let num_files: usize = 4000; let (store, _tempdir, digest) = large_snapshot(&executor, num_files); diff --git a/src/rust/engine/fs/store/src/local_tests.rs b/src/rust/engine/fs/store/src/local_tests.rs index ebebc17b40d0..23ef4e06db97 100644 --- a/src/rust/engine/fs/store/src/local_tests.rs +++ b/src/rust/engine/fs/store/src/local_tests.rs @@ -8,7 +8,7 @@ use bytes::{BufMut, Bytes, BytesMut}; use hashing::{Digest, Fingerprint}; use tempfile::TempDir; use testutil::data::{TestData, TestDirectory}; -use tokio::time::delay_for; +use tokio::time::sleep; use walkdir::WalkDir; #[tokio::test] @@ -195,7 +195,7 @@ async fn garbage_collect_expired() { ); // Wait for it to expire. - delay_for(lease_time * 2).await; + sleep(lease_time * 2).await; assert_eq!( 0, store diff --git a/src/rust/engine/graph/Cargo.toml b/src/rust/engine/graph/Cargo.toml index 58a5c6ee2c6d..06a65a7e9c55 100644 --- a/src/rust/engine/graph/Cargo.toml +++ b/src/rust/engine/graph/Cargo.toml @@ -13,9 +13,9 @@ futures = "0.3" log = "0.4" parking_lot = "0.11" petgraph = "0.4.5" -tokio = { version = "0.2.23", features = ["time"] } +tokio = { version = "^1.4", features = ["time"] } [dev-dependencies] rand = "0.6" env_logger = "0.5.4" -tokio = { version = "0.2.23", features = ["macros", "rt-threaded", "time"] } +tokio = { version = "^1.4", features = ["macros", "rt-multi-thread", "time"] } diff --git a/src/rust/engine/graph/src/lib.rs b/src/rust/engine/graph/src/lib.rs index ead6ad104c0b..30904af79027 100644 --- a/src/rust/engine/graph/src/lib.rs +++ b/src/rust/engine/graph/src/lib.rs @@ -50,7 +50,7 @@ use parking_lot::Mutex; use petgraph::graph::DiGraph; use petgraph::visit::EdgeRef; use petgraph::Direction; -use tokio::time::delay_for; +use tokio::time::sleep; pub use crate::node::{EntryId, Node, NodeContext, NodeError, NodeVisualizer, Stats}; @@ -561,7 +561,7 @@ impl Graph { "Filesystem changed during run: retrying `{}` in {:?}...", node, self.invalidation_delay ); - delay_for(self.invalidation_delay).await; + sleep(self.invalidation_delay).await; continue; } Err(other_err) => break Err(other_err), @@ -620,7 +620,7 @@ impl Graph { }; entry.poll(context, generation).await; if let Some(delay) = delay { - delay_for(delay).await; + sleep(delay).await; } }; diff --git a/src/rust/engine/graph/src/tests.rs b/src/rust/engine/graph/src/tests.rs index 90797e1004d5..4e007776edd1 100644 --- a/src/rust/engine/graph/src/tests.rs +++ b/src/rust/engine/graph/src/tests.rs @@ -11,7 +11,7 @@ use async_trait::async_trait; use futures::future; use parking_lot::Mutex; use rand::{self, Rng}; -use tokio::time::{delay_for, timeout, Elapsed}; +use tokio::time::{error::Elapsed, sleep, timeout}; use crate::{EntryId, Graph, InvalidationResult, Node, NodeContext, NodeError, Stats}; @@ -321,9 +321,9 @@ async fn uncacheable_node_only_runs_once() { let context = { let mut uncacheable = HashSet::new(); uncacheable.insert(TNode::new(1)); - let delay_for_root = Duration::from_millis(1000); + let sleep_root = Duration::from_millis(1000); let mut delays = HashMap::new(); - delays.insert(TNode::new(0), delay_for_root); + delays.insert(TNode::new(0), sleep_root); TContext::new(graph.clone()) .with_uncacheable(uncacheable) .with_delays(delays) @@ -451,9 +451,9 @@ async fn retries() { let graph = Arc::new(Graph::new()); let context = { - let delay_for_root = Duration::from_millis(100); + let sleep_root = Duration::from_millis(100); let mut delays = HashMap::new(); - delays.insert(TNode::new(0), delay_for_root); + delays.insert(TNode::new(0), sleep_root); TContext::new(graph.clone()).with_delays(delays) }; @@ -483,11 +483,11 @@ async fn canceled_on_invalidation() { let invalidation_delay = Duration::from_millis(10); let graph = Arc::new(Graph::new_with_invalidation_delay(invalidation_delay)); - let delay_for_middle = Duration::from_millis(2000); + let sleep_middle = Duration::from_millis(2000); let start_time = Instant::now(); let context = { let mut delays = HashMap::new(); - delays.insert(TNode::new(1), delay_for_middle); + delays.insert(TNode::new(1), sleep_middle); TContext::new(graph.clone()).with_delays(delays) }; @@ -496,7 +496,7 @@ async fn canceled_on_invalidation() { // invalidation to ensure that work actually starts before being invalidated. let iterations = 3; let sleep_per_invalidation = invalidation_delay * 10; - assert!(delay_for_middle > sleep_per_invalidation * 3); + assert!(sleep_middle > sleep_per_invalidation * 3); let graph2 = graph.clone(); let _join = thread::spawn(move || { for _ in 0..iterations { @@ -510,7 +510,7 @@ async fn canceled_on_invalidation() { ); // We should have waited much less than the time it would have taken to complete three times. - assert!(Instant::now() < start_time + (delay_for_middle * iterations)); + assert!(Instant::now() < start_time + (sleep_middle * iterations)); // And the top nodes should have seen three aborts. assert_eq!( @@ -531,17 +531,17 @@ async fn canceled_on_loss_of_interest() { let _logger = env_logger::try_init(); let graph = Arc::new(Graph::new()); - let delay_for_middle = Duration::from_millis(2000); + let sleep_middle = Duration::from_millis(2000); let start_time = Instant::now(); let context = { let mut delays = HashMap::new(); - delays.insert(TNode::new(1), delay_for_middle); + delays.insert(TNode::new(1), sleep_middle); TContext::new(graph.clone()).with_delays(delays) }; // Start a run, but cancel it well before the delayed middle node can complete. tokio::select! { - _ = delay_for(Duration::from_millis(100)) => {}, + _ = sleep(Duration::from_millis(100)) => {}, _ = graph.create(TNode::new(2), &context) => { panic!("Should have timed out.") } } @@ -553,8 +553,8 @@ async fn canceled_on_loss_of_interest() { // We should have waited more than the delay, but less than the time it would have taken to // run twice. - assert!(Instant::now() >= start_time + delay_for_middle); - assert!(Instant::now() < start_time + (delay_for_middle * 2)); + assert!(Instant::now() >= start_time + sleep_middle); + assert!(Instant::now() < start_time + (sleep_middle * 2)); // And the top nodes should have seen one abort each. assert_eq!(vec![TNode::new(2), TNode::new(1),], context.aborts(),); @@ -1005,7 +1005,7 @@ impl TContext { async fn maybe_delay(&self, node: &TNode) { if let Some(delay) = self.delays.get(node) { - delay_for(*delay).await; + sleep(*delay).await; } } diff --git a/src/rust/engine/grpc_util/Cargo.toml b/src/rust/engine/grpc_util/Cargo.toml index 3e652ee7edf7..7d0d3c8f927f 100644 --- a/src/rust/engine/grpc_util/Cargo.toml +++ b/src/rust/engine/grpc_util/Cargo.toml @@ -6,13 +6,12 @@ authors = [ "Pants Build " ] publish = false [dependencies] -bytes = "0.5" +bytes = "1.0" futures = "0.3" -prost = "0.6" -prost-types = "0.6" -rustls-native-certs = "0.4" -tokio = { version = "0.2.23", features = ["process", "rt-threaded", "sync", "tcp", "time"] } -tokio-rustls = "0.14" -tokio-util = { version = "0.2", features = ["codec"] } -tonic = { version = "0.3", features = ["transport", "codegen", "tls", "tls-roots", "prost"] } +rustls-native-certs = "0.5" +prost = "0.7" +tokio = { version = "^1.4", features = ["net", "process", "rt-multi-thread", "sync", "time"] } +tokio-rustls = "0.22" +tokio-util = { version = "0.6", features = ["codec"] } +tonic = { version = "0.4", features = ["transport", "codegen", "tls", "tls-roots", "prost"] } diff --git a/src/rust/engine/logging/Cargo.toml b/src/rust/engine/logging/Cargo.toml index 2783f8f83a2e..64ce7c105603 100644 --- a/src/rust/engine/logging/Cargo.toml +++ b/src/rust/engine/logging/Cargo.toml @@ -14,7 +14,7 @@ num_enum = "0.4" parking_lot = "0.11" regex = "1" stdio = { path = "../stdio" } -tokio = { version = "0.2.23", features = ["rt-util"] } +tokio = { version = "^1.4" } uuid = { version = "0.7", features = ["v4"] } [build-dependencies] diff --git a/src/rust/engine/nailgun/Cargo.toml b/src/rust/engine/nailgun/Cargo.toml index d4242fdcc42e..81847c4dbc9a 100644 --- a/src/rust/engine/nailgun/Cargo.toml +++ b/src/rust/engine/nailgun/Cargo.toml @@ -7,13 +7,13 @@ publish = false [dependencies] async_latch = { path = "../async_latch" } -bytes = "0.5" +bytes = "1.0" futures = "0.3" log = "0.4" -nails = "0.11" +nails = "0.12" os_pipe = "0.9" task_executor = { path = "../task_executor" } -tokio = { version = "0.2.23", features = ["tcp", "fs", "sync", "io-std", "signal"] } +tokio = { version = "^1.4", features = ["fs", "io-std", "io-util", "net", "signal", "sync"] } [dev-dependencies] -tokio = { version = "0.2.23", features = ["dns", "rt-threaded", "macros", "tcp", "io-std"] } +tokio = { version = "^1.4", features = ["io-std", "macros", "net", "rt-multi-thread"] } diff --git a/src/rust/engine/nailgun/src/client.rs b/src/rust/engine/nailgun/src/client.rs index 7304b5ab0246..eac317e44a99 100644 --- a/src/rust/engine/nailgun/src/client.rs +++ b/src/rust/engine/nailgun/src/client.rs @@ -27,17 +27,16 @@ // Arc can be more clear than needing to grok Orderings: #![allow(clippy::mutex_atomic)] -use nails::execution::{stream_for, ChildInput, ChildOutput, ExitCode}; -use nails::Config; -use tokio::net::TcpStream; -use tokio::signal::unix::{signal, Signal, SignalKind}; - use std::io; use std::net::Ipv4Addr; -use tokio::io::AsyncWriteExt; use futures::channel::mpsc; use futures::{try_join, SinkExt, Stream, StreamExt}; +use nails::execution::{stream_for, ChildInput, ChildOutput, ExitCode}; +use nails::Config; +use tokio::io::AsyncWriteExt; +use tokio::net::TcpStream; +use tokio::signal::unix::{signal, Signal, SignalKind}; pub enum NailgunClientError { PreConnect(String), diff --git a/src/rust/engine/nailgun/src/server.rs b/src/rust/engine/nailgun/src/server.rs index 9ef8fdf2f8a6..48755f3844d0 100644 --- a/src/rust/engine/nailgun/src/server.rs +++ b/src/rust/engine/nailgun/src/server.rs @@ -122,7 +122,7 @@ impl Server { config: nails::Config, nail: impl Nail, mut should_exit: oneshot::Receiver<()>, - mut listener: TcpListener, + listener: TcpListener, ) -> Result<(), String> { // While connections are ongoing, they acquire `read`; before shutting down, the server // acquires `write`. @@ -158,7 +158,7 @@ impl Server { let ongoing_connections = ongoing_connections.clone(); async move { let ongoing_connection_guard = ongoing_connections.read().await; - connection_started.notify(); + connection_started.notify_one(); let result = nails::server::handle_connection(config, nail, tcp_stream).await; std::mem::drop(ongoing_connection_guard); result diff --git a/src/rust/engine/nailgun/src/tests.rs b/src/rust/engine/nailgun/src/tests.rs index 36a4c772ecc5..acfd370e769d 100644 --- a/src/rust/engine/nailgun/src/tests.rs +++ b/src/rust/engine/nailgun/src/tests.rs @@ -4,14 +4,13 @@ use std::path::PathBuf; use std::sync::Arc; use std::time::Duration; -use futures::future; +use futures::{future, FutureExt}; use nails::execution::{child_channel, ChildInput, Command, ExitCode}; use nails::Config; use task_executor::Executor; use tokio::net::TcpStream; -use tokio::runtime::Handle; use tokio::sync::Notify; -use tokio::time::delay_for; +use tokio::time::sleep; #[tokio::test] async fn spawn_and_bind() { @@ -47,8 +46,12 @@ async fn shutdown_awaits_ongoing() { let connection_accepted = connection_accepted.clone(); let should_complete_connection = should_complete_connection.clone(); move |_| { - connection_accepted.notify(); - Handle::current().block_on(should_complete_connection.notified()); + connection_accepted.notify_one(); + loop { + if let Some(_) = should_complete_connection.notified().now_or_never() { + break; + } + } exit_code } }) @@ -62,18 +65,18 @@ async fn shutdown_awaits_ongoing() { let mut server_shutdown = tokio::spawn(server.shutdown()); // Confirm that the client doesn't return, and that the server doesn't shutdown. - match future::select(client_completed, delay_for(Duration::from_millis(500))).await { + match future::select(client_completed, sleep(Duration::from_millis(500)).boxed()).await { future::Either::Right((_, c_c)) => client_completed = c_c, - x => panic!("Client should not have completed: {:?}", x), + _ => panic!("Client should not have completed"), } - match future::select(server_shutdown, delay_for(Duration::from_millis(500))).await { + match future::select(server_shutdown, sleep(Duration::from_millis(500)).boxed()).await { future::Either::Right((_, s_s)) => server_shutdown = s_s, - x => panic!("Server should not have shut down: {:?}", x), + _ => panic!("Server should not have shut down"), } // Then signal completion of the connection, and confirm that both the client and server exit // cleanly. - should_complete_connection.notify(); + should_complete_connection.notify_one(); assert_eq!(exit_code, client_completed.await.unwrap().unwrap()); server_shutdown.await.unwrap().unwrap(); } diff --git a/src/rust/engine/process_execution/Cargo.toml b/src/rust/engine/process_execution/Cargo.toml index 1b8e3077ac1a..f9a4ba328e40 100644 --- a/src/rust/engine/process_execution/Cargo.toml +++ b/src/rust/engine/process_execution/Cargo.toml @@ -10,7 +10,7 @@ async-trait = "0.1" walkdir = "2" async_semaphore = { path = "../async_semaphore" } bazel_protos = { path = "bazel_protos" } -bytes = "0.5" +bytes = "1.0" derivative = "2.1.1" grpc_util = { path = "../grpc_util" } fs = { path = "../fs" } @@ -18,7 +18,7 @@ futures = "0.3" hashing = { path = "../hashing" } libc = "0.2.39" log = "0.4" -nails = "0.11" +nails = "0.12" sha2 = "0.9" sharded_lmdb = { path = "../sharded_lmdb" } shell-quote = "0.1.0" @@ -26,9 +26,9 @@ store = { path = "../fs/store" } task_executor = { path = "../task_executor" } tempfile = "3" concrete_time = { path = "../concrete_time" } -tokio = { version = "0.2.23", features = ["process", "rt-threaded", "sync", "tcp", "time"] } -tokio-rustls = "0.14" -tokio-util = { version = "0.2", features = ["codec"] } +tokio = { version = "^1.4", features = ["net", "process", "rt-multi-thread", "sync", "time"] } +tokio-rustls = "0.22" +tokio-util = { version = "0.6", features = ["codec"] } uname = "0.1.1" uuid = { version = "0.7", features = ["v4"] } workunit_store = { path = "../workunit_store" } @@ -40,10 +40,11 @@ serde = "1.0.104" bincode = "1.2.1" double-checked-cell-async = "2.0" rand = "0.6" -prost = { git = "https://github.com/danburkert/prost", rev = "a1cccbcee343e2c444e1cd2738c7fba2599fc391" } -prost-types = "0.6" -tonic = { version = "0.3", features = ["transport", "codegen", "tls", "tls-roots", "prost"] } +prost = "0.7" +prost-types = "0.7" +tonic = { version = "0.4", features = ["transport", "codegen", "tls", "tls-roots", "prost"] } tryfuture = { path = "../tryfuture" } +ouroboros = "0.8" [dev-dependencies] maplit = "1.0.1" @@ -52,4 +53,4 @@ parking_lot = "0.11" spectral = "0.6.0" tempfile = "3" testutil = { path = "../testutil" } -tokio = { version = "0.2.23", features = ["macros"] } +tokio = { version = "^1.4", features = ["macros"] } diff --git a/src/rust/engine/process_execution/bazel_protos/Cargo.toml b/src/rust/engine/process_execution/bazel_protos/Cargo.toml index 0331ca07b011..629aaf191c1a 100644 --- a/src/rust/engine/process_execution/bazel_protos/Cargo.toml +++ b/src/rust/engine/process_execution/bazel_protos/Cargo.toml @@ -6,18 +6,18 @@ authors = [ "Pants Build " ] publish = false [dependencies] -bytes = "0.5" +bytes = "1.0" hashing = { path = "../../hashing" } -prost = { git = "https://github.com/danburkert/prost", rev = "a1cccbcee343e2c444e1cd2738c7fba2599fc391" } -prost-build = { git = "https://github.com/danburkert/prost", rev = "a1cccbcee343e2c444e1cd2738c7fba2599fc391" } -prost-types = "0.6" -tonic = { version = "0.3", features = ["transport", "codegen", "tls", "tls-roots"] } +prost = "0.7" +prost-build = "0.7" +prost-types = "0.7" +tonic = { version = "0.4", features = ["transport", "codegen", "tls", "tls-roots"] } [build-dependencies] build_utils = { path = "../../build_utils" } copy_dir = "0.1.2" dir-diff = "0.3.1" tempfile = "3" -prost-build = { git = "https://github.com/danburkert/prost", rev = "a1cccbcee343e2c444e1cd2738c7fba2599fc391" } -tonic-build = { version = "0.3", features = ["prost"] } +prost-build = "0.7" +tonic-build = { version = "0.4", features = ["prost"] } walkdir = "2" diff --git a/src/rust/engine/process_execution/src/local.rs b/src/rust/engine/process_execution/src/local.rs index e5707c95d126..afdab3d7e6d1 100644 --- a/src/rust/engine/process_execution/src/local.rs +++ b/src/rust/engine/process_execution/src/local.rs @@ -35,6 +35,9 @@ use crate::{ Context, FallibleProcessResultWithPlatform, MultiPlatformProcess, NamedCaches, Platform, Process, ProcessResultMetadata, }; +use futures::task::Poll; +use futures::Stream; +use tonic::codegen::Pin; pub const USER_EXECUTABLE_MODE: u32 = 0o100755; @@ -277,6 +280,27 @@ impl super::CommandRunner for CommandRunner { } } +use ouroboros::self_referencing; + +#[self_referencing] +struct OwnedChild { + child: Box, + #[borrows(mut child)] + #[not_covariant] + exit_stream: BoxStream<'this, Result>, +} + +impl Stream for OwnedChild { + type Item = Result; + + fn poll_next( + mut self: Pin<&mut Self>, + cx: &mut std::task::Context<'_>, + ) -> Poll> { + self.with_exit_stream_mut(|es| Pin::new(es).poll_next(cx)) + } +} + #[async_trait] impl CapturedWorkdir for CommandRunner { fn named_caches(&self) -> &NamedCaches { @@ -330,7 +354,7 @@ impl CapturedWorkdir for CommandRunner { // process but outside of our control (in libraries). As such, we back-stop by sleeping and // trying again for a while if we do hit one of these fork races we do not control. const MAX_ETXTBSY_WAIT: Duration = Duration::from_millis(100); - let mut retries = 0; + let mut retries: u32 = 0; let mut sleep_millis = 1; let start_time = std::time::Instant::now(); @@ -339,7 +363,7 @@ impl CapturedWorkdir for CommandRunner { Err(e) => { if e.raw_os_error() == Some(libc::ETXTBSY) && start_time.elapsed() < MAX_ETXTBSY_WAIT { - tokio::time::delay_for(std::time::Duration::from_millis(sleep_millis)).await; + tokio::time::sleep(std::time::Duration::from_millis(sleep_millis)).await; retries += 1; sleep_millis *= 2; continue; @@ -363,27 +387,39 @@ impl CapturedWorkdir for CommandRunner { } }?; - debug!("spawned local process as {} for {:?}", child.id(), req); + debug!("spawned local process as {:?} for {:?}", child.id(), req); let stdout_stream = FramedRead::new(child.stdout.take().unwrap(), BytesCodec::new()) .map_ok(|bytes| ChildOutput::Stdout(bytes.into())) + .fuse() .boxed(); let stderr_stream = FramedRead::new(child.stderr.take().unwrap(), BytesCodec::new()) .map_ok(|bytes| ChildOutput::Stderr(bytes.into())) + .fuse() .boxed(); - let exit_stream = child - .into_stream() - .map_ok(|exit_status| { - ChildOutput::Exit(ExitCode( - exit_status - .code() - .or_else(|| exit_status.signal().map(Neg::neg)) - .expect("Child process should exit via returned code or signal."), - )) - }) - .boxed(); + let owned_child = OwnedChildBuilder { + child: Box::new(child), + exit_stream_builder: |child: &mut Child| { + child + .wait() + .into_stream() + .map_ok(|exit_status| { + ChildOutput::Exit(ExitCode( + exit_status + .code() + .or_else(|| exit_status.signal().map(Neg::neg)) + .expect("Child process should exit via returned code or signal."), + )) + }) + .boxed() + }, + } + .build(); + + let result_stream = + futures::stream::select_all(vec![stdout_stream, stderr_stream, owned_child.boxed()]); Ok( - futures::stream::select_all(vec![stdout_stream, stderr_stream, exit_stream]) + result_stream .map_err(|e| format!("Failed to consume process outputs: {:?}", e)) .boxed(), ) diff --git a/src/rust/engine/process_execution/src/remote.rs b/src/rust/engine/process_execution/src/remote.rs index a960c1f2e284..e3683e6f8466 100644 --- a/src/rust/engine/process_execution/src/remote.rs +++ b/src/rust/engine/process_execution/src/remote.rs @@ -589,7 +589,7 @@ impl CommandRunner { let sleep_time = self.retry_interval_duration * multiplier; let sleep_time = sleep_time.min(MAX_BACKOFF_DURATION); debug!("delaying {:?} before retry", sleep_time); - tokio::time::delay_for(sleep_time).await; + tokio::time::sleep(sleep_time).await; } let rpc_result = match current_operation_name { diff --git a/src/rust/engine/process_execution/src/remote_cache_tests.rs b/src/rust/engine/process_execution/src/remote_cache_tests.rs index 114f718ff559..9f7cc4ffb88a 100644 --- a/src/rust/engine/process_execution/src/remote_cache_tests.rs +++ b/src/rust/engine/process_execution/src/remote_cache_tests.rs @@ -15,7 +15,7 @@ use remexec::ActionResult; use store::Store; use tempfile::TempDir; use testutil::data::{TestData, TestDirectory, TestTree}; -use tokio::time::delay_for; +use tokio::time::sleep; use workunit_store::WorkunitStore; use crate::remote::{ensure_action_stored_locally, make_execute_request}; @@ -60,7 +60,7 @@ impl CommandRunnerTrait for MockLocalCommandRunner { _req: MultiPlatformProcess, _context: Context, ) -> Result { - delay_for(self.delay).await; + sleep(self.delay).await; self.call_counter.fetch_add(1, Ordering::SeqCst); self.result.clone() } @@ -317,7 +317,7 @@ async fn cache_write_success() { assert_eq!(local_runner_call_counter.load(Ordering::SeqCst), 1); // Wait for the cache write block to finish. - delay_for(Duration::from_secs(1)).await; + sleep(Duration::from_secs(1)).await; assert_eq!(action_cache.action_map.lock().len(), 1); let action_map_mutex_guard = action_cache.action_map.lock(); assert_eq!( @@ -348,7 +348,7 @@ async fn cache_write_not_for_failures() { assert_eq!(local_runner_call_counter.load(Ordering::SeqCst), 1); // Wait for the cache write block to finish. - delay_for(Duration::from_millis(100)).await; + sleep(Duration::from_millis(100)).await; assert!(action_cache.action_map.lock().is_empty()); } @@ -376,7 +376,7 @@ async fn cache_write_does_not_block() { // CommandRunner::run(). assert!(action_cache.action_map.lock().is_empty()); - delay_for(Duration::from_secs(1)).await; + sleep(Duration::from_secs(1)).await; assert_eq!(action_cache.action_map.lock().len(), 1); let action_map_mutex_guard = action_cache.action_map.lock(); assert_eq!( diff --git a/src/rust/engine/process_executor/Cargo.toml b/src/rust/engine/process_executor/Cargo.toml index f8b2abbf5d84..622b49df3505 100644 --- a/src/rust/engine/process_executor/Cargo.toml +++ b/src/rust/engine/process_executor/Cargo.toml @@ -15,10 +15,10 @@ futures = "0.3" hashing = { path = "../hashing" } log = "0.4" process_execution = { path = "../process_execution" } -prost = { git = "https://github.com/danburkert/prost", rev = "a1cccbcee343e2c444e1cd2738c7fba2599fc391" } +prost = "0.7" shlex = "0.1.1" store = { path = "../fs/store" } structopt = "0.3.20" task_executor = { path = "../task_executor" } -tokio = { version = "0.2.23", features = ["rt-threaded", "macros"] } +tokio = { version = "^1.4", features = ["rt-multi-thread", "macros"] } workunit_store = { path = "../workunit_store"} diff --git a/src/rust/engine/sharded_lmdb/Cargo.toml b/src/rust/engine/sharded_lmdb/Cargo.toml index 254bda3537db..b2ab9f8511e8 100644 --- a/src/rust/engine/sharded_lmdb/Cargo.toml +++ b/src/rust/engine/sharded_lmdb/Cargo.toml @@ -5,7 +5,7 @@ authors = [ "Pants Build " ] edition = "2018" [dependencies] -bytes = "0.5" +bytes = "1.0" fs = { path = "../fs" } futures = "0.3" hashing = { path = "../hashing" } diff --git a/src/rust/engine/src/nodes.rs b/src/rust/engine/src/nodes.rs index da137df46835..f9be97afe5f1 100644 --- a/src/rust/engine/src/nodes.rs +++ b/src/rust/engine/src/nodes.rs @@ -22,7 +22,7 @@ use crate::externs::engine_aware::{self, EngineAwareInformation}; use crate::selectors; use crate::tasks::{self, Rule}; use crate::Types; -use bytes::buf::BufMutExt; +use bytes::BufMut; use cpython::{PyObject, Python, PythonObject}; use fs::{ self, Dir, DirectoryListing, File, FileContent, GlobExpansionConjunction, GlobMatching, Link, @@ -758,7 +758,7 @@ impl StreamingDownload for NetDownload { } struct FileDownload { - stream: tokio::io::ReaderStream, + stream: tokio_util::io::ReaderStream, } impl FileDownload { @@ -769,7 +769,7 @@ impl FileDownload { e, path, file_name ) })?; - let stream = tokio::io::reader_stream(file); + let stream = tokio_util::io::ReaderStream::new(file); Ok(FileDownload { stream }) } } diff --git a/src/rust/engine/src/scheduler.rs b/src/rust/engine/src/scheduler.rs index 5f4971b2f2ee..f7c33ede1d44 100644 --- a/src/rust/engine/src/scheduler.rs +++ b/src/rust/engine/src/scheduler.rs @@ -14,7 +14,7 @@ use crate::core::{Failure, Params, TypeId, Value}; use crate::nodes::{Select, Visualizer}; use crate::session::{ObservedValueResult, Root, Session}; -use futures::{future, FutureExt}; +use futures::{future, FutureExt, TryFutureExt}; use graph::LastObserved; use hashing::{Digest, EMPTY_DIGEST}; use log::{debug, warn}; @@ -254,10 +254,10 @@ impl Scheduler { _ = session.cancelled() => { // The Session was cancelled: kill the process, and then wait for it to exit (to avoid // zombies). - subprocess.kill().map_err(|e| format!("Failed to interrupt child process: {}", e))?; - subprocess.await.map_err(|e| e.to_string()) + subprocess.kill().map_err(|e| format!("Failed to interrupt child process: {}", e)).await?; + subprocess.wait().await.map_err(|e| e.to_string()) } - exit_status = &mut subprocess => { + exit_status = subprocess.wait() => { // The process exited. exit_status.map_err(|e| e.to_string()) } @@ -366,7 +366,7 @@ impl Scheduler { let mut execution_task = self.execute_helper(request, session).boxed(); self.core.executor.block_on(async move { - let mut refresh_delay = time::delay_for(Self::refresh_delay(interval, deadline)); + let mut refresh_delay = time::sleep(Self::refresh_delay(interval, deadline)).boxed(); let result = loop { tokio::select! { _ = session.cancelled() => { @@ -383,7 +383,7 @@ impl Scheduler { // Just a receive timeout. render and continue. session.maybe_display_render(); } - refresh_delay = time::delay_for(Self::refresh_delay(interval, deadline)); + refresh_delay = time::sleep(Self::refresh_delay(interval, deadline)).boxed(); } res = &mut execution_task => { // Completed successfully. diff --git a/src/rust/engine/stdio/Cargo.toml b/src/rust/engine/stdio/Cargo.toml index 6c8c4fee59aa..9612277108db 100644 --- a/src/rust/engine/stdio/Cargo.toml +++ b/src/rust/engine/stdio/Cargo.toml @@ -8,4 +8,4 @@ publish = false [dependencies] log = "0.4" parking_lot = "0.11" -tokio = { version = "0.2.23", features = ["rt-util"] } +tokio = { version = "^1.4", features = ["rt"] } diff --git a/src/rust/engine/task_executor/Cargo.toml b/src/rust/engine/task_executor/Cargo.toml index eda711b80104..df09b5a6def7 100644 --- a/src/rust/engine/task_executor/Cargo.toml +++ b/src/rust/engine/task_executor/Cargo.toml @@ -10,5 +10,5 @@ arc-swap = "1.2" futures = "0.3" lazy_static = "1" stdio = { path = "../stdio" } -tokio = { version = "0.2.23", features = ["blocking", "rt-threaded"] } +tokio = { version = "^1.4", features = ["rt-multi-thread"] } workunit_store = { path = "../workunit_store" } diff --git a/src/rust/engine/task_executor/src/lib.rs b/src/rust/engine/task_executor/src/lib.rs index b6d84dfe3d25..c71f72e63a10 100644 --- a/src/rust/engine/task_executor/src/lib.rs +++ b/src/rust/engine/task_executor/src/lib.rs @@ -71,7 +71,7 @@ impl Executor { /// need thread configurability, but also want to know reliably when the Runtime will shutdown /// (which, because it is static, will only be at the entire process' exit). /// - pub fn global(core_threads: usize, num_threads: usize) -> Result { + pub fn global(num_worker_threads: usize, max_threads: usize) -> Result { let global = GLOBAL_EXECUTOR.load(); if let Some(ref runtime) = *global { return Ok(Executor { @@ -80,18 +80,16 @@ impl Executor { }); } - // Otherwise, attempt to create and swap in the Runtime. - let runtime = Builder::new() - .core_threads(core_threads) - .max_threads(num_threads) - .threaded_scheduler() + let runtime = Builder::new_multi_thread() + .worker_threads(num_worker_threads) + .max_blocking_threads(max_threads - num_worker_threads) .enable_all() .build() .map_err(|e| format!("Failed to start the runtime: {}", e))?; // Attempt to swap, then recurse to retry. GLOBAL_EXECUTOR.compare_and_swap(global, Some(Arc::new(runtime))); - Self::global(core_threads, num_threads) + Self::global(num_worker_threads, max_threads) } /// @@ -102,7 +100,8 @@ impl Executor { where F: FnOnce() -> R, { - self.handle.enter(f) + let _context = self.handle.enter(); + f() } /// @@ -159,12 +158,14 @@ impl Executor { let workunit_store_handle = workunit_store::get_workunit_store_handle(); // NB: We unwrap here because the only thing that should cause an error in a spawned task is a // panic, in which case we want to propagate that. - tokio::task::spawn_blocking(move || { - stdio::set_thread_destination(stdio_destination); - workunit_store::set_thread_workunit_store_handle(workunit_store_handle); - f() - }) - .map(|r| r.expect("Background task exited unsafely.")) + self + .handle + .spawn_blocking(move || { + stdio::set_thread_destination(stdio_destination); + workunit_store::set_thread_workunit_store_handle(workunit_store_handle); + f() + }) + .map(|r| r.expect("Background task exited unsafely.")) } /// diff --git a/src/rust/engine/testutil/Cargo.toml b/src/rust/engine/testutil/Cargo.toml index 1eec533d6378..343e335036a3 100644 --- a/src/rust/engine/testutil/Cargo.toml +++ b/src/rust/engine/testutil/Cargo.toml @@ -8,8 +8,8 @@ publish = false [dependencies] async-stream = "0.2" bazel_protos = { path = "../process_execution/bazel_protos" } -bytes = "0.5" +bytes = "1.0" grpc_util = { path = "../grpc_util" } fs = { path = "../fs" } hashing = { path = "../hashing" } -prost = { git = "https://github.com/danburkert/prost", rev = "a1cccbcee343e2c444e1cd2738c7fba2599fc391" } +prost = "0.7" diff --git a/src/rust/engine/testutil/mock/Cargo.toml b/src/rust/engine/testutil/mock/Cargo.toml index 524faf9a7507..a74fe581b7f6 100644 --- a/src/rust/engine/testutil/mock/Cargo.toml +++ b/src/rust/engine/testutil/mock/Cargo.toml @@ -8,14 +8,14 @@ publish = false [dependencies] async-stream = "0.2" bazel_protos = { path = "../../process_execution/bazel_protos" } -bytes = "0.5" +bytes = "1.0" futures = "0.3" hashing = { path = "../../hashing" } -hyper = { version = "0.13", features = ["stream", "tcp"] } +hyper = { version = "0.14", features = ["stream", "tcp"] } log = "0.4" parking_lot = "0.11" -prost = { git = "https://github.com/danburkert/prost", rev = "a1cccbcee343e2c444e1cd2738c7fba2599fc391" } -prost-types = "0.6" +prost = "0.7" +prost-types = "0.7" testutil = { path = ".." } -tokio = { version = "0.2.23", features = ["time"] } -tonic = { version = "0.3" } +tokio = { version = "^1.4", features = ["time"] } +tonic = { version = "0.4" } diff --git a/src/rust/engine/testutil/mock/src/action_cache.rs b/src/rust/engine/testutil/mock/src/action_cache.rs index 0eaf66deed13..b35a0ee94881 100644 --- a/src/rust/engine/testutil/mock/src/action_cache.rs +++ b/src/rust/engine/testutil/mock/src/action_cache.rs @@ -40,7 +40,7 @@ use hashing::{Digest, Fingerprint}; use parking_lot::Mutex; use remexec::action_cache_server::{ActionCache, ActionCacheServer}; use remexec::{ActionResult, GetActionResultRequest, UpdateActionResultRequest}; -use tokio::time::delay_for; +use tokio::time::sleep; use tonic::transport::Server; use tonic::{Request, Response, Status}; @@ -73,7 +73,7 @@ impl ActionCache for ActionCacheResponder { &self, request: Request, ) -> Result, Status> { - delay_for(self.read_delay).await; + sleep(self.read_delay).await; let request = request.into_inner(); @@ -108,7 +108,7 @@ impl ActionCache for ActionCacheResponder { &self, request: Request, ) -> Result, Status> { - delay_for(self.write_delay).await; + sleep(self.write_delay).await; let request = request.into_inner(); diff --git a/src/rust/engine/testutil/mock/src/execution_server.rs b/src/rust/engine/testutil/mock/src/execution_server.rs index d162b8d9defd..e423c8665348 100644 --- a/src/rust/engine/testutil/mock/src/execution_server.rs +++ b/src/rust/engine/testutil/mock/src/execution_server.rs @@ -250,7 +250,7 @@ impl MockResponder { let stream = async_stream::stream! { for op in operations { if let Some(d) = op.duration { - tokio::time::delay_for(d).await; + tokio::time::sleep(d).await; } if let Ok(Some(op)) = op.op { @@ -388,7 +388,7 @@ impl Operations for MockResponder { }) => { if request.name == operation_name { if let Some(d) = operation.duration { - tokio::time::delay_for(d).await; + tokio::time::sleep(d).await; } if let Ok(Some(op)) = operation.op { // Complete the channel with the op. diff --git a/src/rust/engine/watch/Cargo.toml b/src/rust/engine/watch/Cargo.toml index 7c2e7deca61a..15638d1a4c5d 100644 --- a/src/rust/engine/watch/Cargo.toml +++ b/src/rust/engine/watch/Cargo.toml @@ -19,4 +19,4 @@ task_executor = { path = "../task_executor" } [dev-dependencies] tempfile = "3" testutil = { path = "../testutil" } -tokio = { version = "0.2.23", features = ["rt-core", "macros"] } +tokio = { version = "^1.4", features = ["rt", "macros"] } diff --git a/src/rust/engine/workunit_store/Cargo.toml b/src/rust/engine/workunit_store/Cargo.toml index 74db2dd510c2..949d7db66a5a 100644 --- a/src/rust/engine/workunit_store/Cargo.toml +++ b/src/rust/engine/workunit_store/Cargo.toml @@ -6,13 +6,13 @@ authors = [ "Pants Build " ] publish = false [dependencies] -bytes = "0.5" +bytes = "1.0" concrete_time = { path = "../concrete_time" } hashing = { path = "../hashing" } hdrhistogram = "7.2" parking_lot = "0.11" rand = "0.6" -tokio = { version = "0.2.23", features = ["rt-util"] } +tokio = { version = "^1.4", features = ["rt"] } petgraph = "0.4.5" log = "0.4" strum = "0.20" diff --git a/src/rust/engine/workunit_store/src/lib.rs b/src/rust/engine/workunit_store/src/lib.rs index 51772cfb3338..0f595bba89cb 100644 --- a/src/rust/engine/workunit_store/src/lib.rs +++ b/src/rust/engine/workunit_store/src/lib.rs @@ -35,9 +35,12 @@ use std::sync::mpsc::{channel, Receiver, Sender}; use std::sync::Arc; use std::time::{Duration, SystemTime}; +use bytes::{BufMut, Bytes, BytesMut}; use concrete_time::TimeSpan; +use hdrhistogram::serialization::Serializer; use log::log; pub use log::Level; +pub use metrics::{Metric, ObservationMetric}; use parking_lot::Mutex; use petgraph::graph::{DiGraph, NodeIndex}; use rand::thread_rng; @@ -45,10 +48,6 @@ use rand::Rng; use tokio::task_local; mod metrics; -use bytes::buf::BufMutExt; -use bytes::{Bytes, BytesMut}; -use hdrhistogram::serialization::Serializer; -pub use metrics::{Metric, ObservationMetric}; #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Ord, PartialOrd)] pub struct SpanId(u64);