From 67513752e6cbdb6f980210728428ad5af2d1a3c6 Mon Sep 17 00:00:00 2001 From: Vlad Lazar Date: Thu, 3 Oct 2024 16:48:08 +0100 Subject: [PATCH] Revert "vm-monitor: Upgrade axum from 0.6 to 0.7 (#9257)" This reverts commit 53b6e1a01cfcab751bace0017223d8dc3360d60f. --- Cargo.lock | 79 ++++++++++++++++++++++++++++---------- Cargo.toml | 4 +- libs/vm_monitor/src/lib.rs | 18 ++++----- workspace_hack/Cargo.toml | 2 - 4 files changed, 69 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 390961ec23..cde9aa7a77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -668,20 +668,19 @@ dependencies = [ [[package]] name = "axum" -version = "0.7.5" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" dependencies = [ "async-trait", - "axum-core", + "axum-core 0.3.4", "base64 0.21.1", + "bitflags 1.3.2", "bytes", "futures-util", - "http 1.1.0", - "http-body 1.0.0", - "http-body-util", - "hyper 1.4.1", - "hyper-util", + "http 0.2.9", + "http-body 0.4.5", + "hyper 0.14.30", "itoa", "matchit 0.7.0", "memchr", @@ -694,13 +693,56 @@ dependencies = [ "serde_path_to_error", "serde_urlencoded", "sha1", - "sync_wrapper 1.0.1", + "sync_wrapper 0.1.2", "tokio", "tokio-tungstenite", "tower", "tower-layer", "tower-service", - "tracing", +] + +[[package]] +name = "axum" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +dependencies = [ + "async-trait", + "axum-core 0.4.5", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "itoa", + "matchit 0.7.0", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper 1.0.1", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 0.2.9", + "http-body 0.4.5", + "mime", + "rustversion", + "tower-layer", + "tower-service", ] [[package]] @@ -721,7 +763,6 @@ dependencies = [ "sync_wrapper 1.0.1", "tower-layer", "tower-service", - "tracing", ] [[package]] @@ -6289,9 +6330,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.21.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +checksum = "2b2dbec703c26b00d74844519606ef15d09a7d6857860f84ad223dec002ddea2" dependencies = [ "futures-util", "log", @@ -6358,7 +6399,7 @@ checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" dependencies = [ "async-stream", "async-trait", - "axum", + "axum 0.7.5", "base64 0.22.1", "bytes", "h2 0.4.4", @@ -6565,14 +6606,14 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" -version = "0.21.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" dependencies = [ "byteorder", "bytes", "data-encoding", - "http 1.1.0", + "http 0.2.9", "httparse", "log", "rand 0.8.5", @@ -6800,7 +6841,7 @@ name = "vm_monitor" version = "0.1.0" dependencies = [ "anyhow", - "axum", + "axum 0.6.20", "cgroups-rs", "clap", "futures", @@ -7265,8 +7306,6 @@ dependencies = [ "aws-smithy-async", "aws-smithy-http", "aws-smithy-types", - "axum", - "axum-core", "base64 0.21.1", "base64ct", "bytes", diff --git a/Cargo.toml b/Cargo.toml index 9f5ff7b739..abdb978f3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,7 +61,7 @@ aws-smithy-types = "1.2" aws-credential-types = "1.2.0" aws-sigv4 = { version = "1.2", features = ["sign-http"] } aws-types = "1.3" -axum = { version = "0.7.5", features = ["ws"] } +axum = { version = "0.6.20", features = ["ws"] } base64 = "0.13.0" bincode = "1.3" bindgen = "0.70" @@ -102,7 +102,7 @@ humantime-serde = "1.1.1" hyper = "0.14" hyper_1 = { package = "hyper", version = "1.4" } hyper-util = "0.1" -tokio-tungstenite = "0.21.0" +tokio-tungstenite = "0.20.0" indexmap = "2" indoc = "2" ipnet = "2.9.0" diff --git a/libs/vm_monitor/src/lib.rs b/libs/vm_monitor/src/lib.rs index 1b13c8e0b2..89ca91fdd7 100644 --- a/libs/vm_monitor/src/lib.rs +++ b/libs/vm_monitor/src/lib.rs @@ -7,13 +7,11 @@ use axum::{ extract::{ws::WebSocket, State, WebSocketUpgrade}, response::Response, }; -use axum::{routing::get, Router}; +use axum::{routing::get, Router, Server}; use clap::Parser; use futures::Future; -use std::net::SocketAddr; use std::{fmt::Debug, time::Duration}; use sysinfo::{RefreshKind, System, SystemExt}; -use tokio::net::TcpListener; use tokio::{sync::broadcast, task::JoinHandle}; use tokio_util::sync::CancellationToken; use tracing::{error, info}; @@ -134,14 +132,14 @@ pub async fn start(args: &'static Args, token: CancellationToken) -> anyhow::Res args, }); - let addr_str = args.addr(); - let addr: SocketAddr = addr_str.parse().expect("parsing address should not fail"); - - let listener = TcpListener::bind(&addr) - .await + let addr = args.addr(); + let bound = Server::try_bind(&addr.parse().expect("parsing address should not fail")) .with_context(|| format!("failed to bind to {addr}"))?; - info!(addr_str, "server bound"); - axum::serve(listener, app.into_make_service()) + + info!(addr, "server bound"); + + bound + .serve(app.into_make_service()) .await .context("server exited")?; diff --git a/workspace_hack/Cargo.toml b/workspace_hack/Cargo.toml index 25a31e04df..ac4857bc50 100644 --- a/workspace_hack/Cargo.toml +++ b/workspace_hack/Cargo.toml @@ -23,8 +23,6 @@ aws-sigv4 = { version = "1", features = ["http0-compat", "sign-eventstream", "si aws-smithy-async = { version = "1", default-features = false, features = ["rt-tokio"] } aws-smithy-http = { version = "0.60", default-features = false, features = ["event-stream"] } aws-smithy-types = { version = "1", default-features = false, features = ["byte-stream-poll-next", "http-body-0-4-x", "http-body-1-x", "rt-tokio", "test-util"] } -axum = { version = "0.7", features = ["ws"] } -axum-core = { version = "0.4", default-features = false, features = ["tracing"] } base64 = { version = "0.21", features = ["alloc"] } base64ct = { version = "1", default-features = false, features = ["std"] } bytes = { version = "1", features = ["serde"] }