From ed5eaed1a8b6164cc52c6ead7affc496f512500c Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Sun, 11 Feb 2024 12:39:35 -0800 Subject: [PATCH 01/23] Set rust version --- .github/workflows/ci.yml | 2 +- bin-functions/rust-toolchain.toml | 2 +- container-proxy/rust-toolchain | 1 - container-proxy/rust-toolchain.toml | 2 ++ wasm-worker/rust-toolchain.toml | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) delete mode 100644 container-proxy/rust-toolchain create mode 100644 container-proxy/rust-toolchain.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7df5f4ee..c8570f634 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: - name: Install rustc and clippy nightly uses: dtolnay/rust-toolchain@stable with: - toolchain: nightly-2024-02-01 #make sure this matches the version in the rust-toolchain files + toolchain: nightly-2024-01-31 #make sure this matches the version in the rust-toolchain files components: cargo, rustc, clippy, rustfmt target: wasm32-unknown-unknown - name: Setup rust dependency caching diff --git a/bin-functions/rust-toolchain.toml b/bin-functions/rust-toolchain.toml index 62ac4ec16..423211e26 100644 --- a/bin-functions/rust-toolchain.toml +++ b/bin-functions/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel="nightly-2024-02-01" +channel="nightly-2024-01-31" diff --git a/container-proxy/rust-toolchain b/container-proxy/rust-toolchain deleted file mode 100644 index d7aace133..000000000 --- a/container-proxy/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -nightly-2024-02-01 diff --git a/container-proxy/rust-toolchain.toml b/container-proxy/rust-toolchain.toml new file mode 100644 index 000000000..423211e26 --- /dev/null +++ b/container-proxy/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel="nightly-2024-01-31" diff --git a/wasm-worker/rust-toolchain.toml b/wasm-worker/rust-toolchain.toml index 62ac4ec16..423211e26 100644 --- a/wasm-worker/rust-toolchain.toml +++ b/wasm-worker/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel="nightly-2024-02-01" +channel="nightly-2024-01-31" From afedeab181886471df3986fa80a08b152059dd52 Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Sun, 11 Feb 2024 13:04:51 -0800 Subject: [PATCH 02/23] Update toolchain file --- bin-functions/rust-toolchain.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/bin-functions/rust-toolchain.toml b/bin-functions/rust-toolchain.toml index 423211e26..e052f74c8 100644 --- a/bin-functions/rust-toolchain.toml +++ b/bin-functions/rust-toolchain.toml @@ -1,2 +1,3 @@ [toolchain] channel="nightly-2024-01-31" +targets=["wasm32-unknown-unknown"] From 7551552de7febbbc8b98da412193e55310b8c769 Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Mon, 4 Mar 2024 14:18:39 -0800 Subject: [PATCH 03/23] update dependencies --- bin-functions/Cargo.lock | 196 +++++----------- .../src/internal/standalone/config.rs | 2 +- container-proxy/Cargo.lock | 195 ++++++++++------ wasm-image/runtimes/native/Cargo.lock | 161 +++++++++---- wasm-image/runtimes/native/Cargo.toml | 2 +- wasm-image/runtimes/native/src/main.rs | 64 ++++-- wasm-worker/Cargo.lock | 215 +++++++++--------- 7 files changed, 442 insertions(+), 393 deletions(-) diff --git a/bin-functions/Cargo.lock b/bin-functions/Cargo.lock index 0cb807150..3b7a3a321 100644 --- a/bin-functions/Cargo.lock +++ b/bin-functions/Cargo.lock @@ -56,12 +56,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bitflags" -version = "2.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" - [[package]] name = "block-buffer" version = "0.10.4" @@ -85,12 +79,9 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "a0ba8f7aaa012f30d5b2861462f6708eccd49c3c39863fe083a308035f63d723" [[package]] name = "cfg-if" @@ -109,9 +100,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] @@ -149,22 +140,6 @@ dependencies = [ "termcolor", ] -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] -name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - [[package]] name = "flate2" version = "1.0.28" @@ -235,38 +210,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" - -[[package]] -name = "hoot" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df22a4d90f1b0e65fe3e0d6ee6a4608cc4d81f4b2eb3e670f44bb6bde711e452" -dependencies = [ - "httparse", - "log", -] - -[[package]] -name = "hootbin" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "354e60868e49ea1a39c44b9562ad207c4259dc6eabf9863bf3b0f058c55cfdb2" -dependencies = [ - "fastrand", - "hoot", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "httparse" -version = "1.8.0" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "humantime" @@ -276,9 +222,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "idna" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -294,12 +240,12 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix", + "libc", "windows-sys", ] @@ -315,17 +261,11 @@ version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" -[[package]] -name = "linux-raw-sys" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" - [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "memchr" @@ -335,9 +275,9 @@ checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -487,9 +427,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -508,30 +448,17 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustix" -version = "0.38.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "serde" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] @@ -547,9 +474,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", @@ -558,9 +485,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -580,9 +507,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -598,26 +525,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "thiserror" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -635,9 +542,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "pin-project-lite", @@ -696,22 +603,21 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "ureq" -version = "2.9.4" +version = "2.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399dd89e2af196ae4f83a47bb37a1455e664fe2fed97b3ae68a1c4a3f8216e76" +checksum = "11f214ce18d8b2cbe84ed3aa6486ed3f5b285cf8d8fbdbce9f3f767a724adc35" dependencies = [ "base64", "flate2", - "hootbin", "log", "once_cell", "serde", @@ -721,9 +627,9 @@ dependencies = [ [[package]] name = "url" -version = "2.3.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -784,9 +690,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -799,42 +705,42 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" diff --git a/bin-functions/bindings/src/internal/standalone/config.rs b/bin-functions/bindings/src/internal/standalone/config.rs index cc1b988dc..192dc7375 100644 --- a/bin-functions/bindings/src/internal/standalone/config.rs +++ b/bin-functions/bindings/src/internal/standalone/config.rs @@ -1,3 +1,3 @@ -pub fn get_config_value(_key: &str) -> Result { +pub fn get_config_value(_key: &str) -> Result { unimplemented!(); } diff --git a/container-proxy/Cargo.lock b/container-proxy/Cargo.lock index eb65dd046..39c4556f9 100644 --- a/container-proxy/Cargo.lock +++ b/container-proxy/Cargo.lock @@ -67,9 +67,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" [[package]] name = "bytes" @@ -79,12 +79,9 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "a0ba8f7aaa012f30d5b2861462f6708eccd49c3c39863fe083a308035f63d723" [[package]] name = "cfg-if" @@ -245,15 +242,15 @@ checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -300,7 +297,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.5", + "socket2 0.5.6", "tokio", "tower-service", "tracing", @@ -319,9 +316,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.2" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown", @@ -351,9 +348,9 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -382,9 +379,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "memchr" @@ -400,22 +397,22 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -492,7 +489,7 @@ dependencies = [ "libc", "redox_syscall 0.4.1", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -626,9 +623,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "scopeguard" @@ -638,9 +635,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] @@ -656,9 +653,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", @@ -667,9 +664,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -735,19 +732,19 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "syn" -version = "2.0.48" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -809,9 +806,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -820,9 +817,9 @@ dependencies = [ "num_cpus", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.5", + "socket2 0.5.6", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -931,9 +928,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] @@ -966,9 +963,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -976,9 +973,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", @@ -991,9 +988,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.40" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -1003,9 +1000,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1013,9 +1010,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", @@ -1026,15 +1023,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -1068,7 +1065,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.4", ] [[package]] @@ -1077,13 +1083,28 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +dependencies = [ + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -1092,42 +1113,84 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" + [[package]] name = "winreg" version = "0.50.0" @@ -1135,5 +1198,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if", - "windows-sys", + "windows-sys 0.48.0", ] diff --git a/wasm-image/runtimes/native/Cargo.lock b/wasm-image/runtimes/native/Cargo.lock index 21e38d522..794c63e08 100644 --- a/wasm-image/runtimes/native/Cargo.lock +++ b/wasm-image/runtimes/native/Cargo.lock @@ -44,6 +44,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" + [[package]] name = "bytes" version = "1.5.0" @@ -52,12 +58,9 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "a0ba8f7aaa012f30d5b2861462f6708eccd49c3c39863fe083a308035f63d723" [[package]] name = "cfg-if" @@ -65,6 +68,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "dashmap" version = "5.5.3" @@ -144,15 +153,15 @@ checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -235,9 +244,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "memchr" @@ -245,46 +254,36 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "nix" -version = "0.26.4" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" dependencies = [ - "bitflags", + "bitflags 2.4.2", "cfg-if", + "cfg_aliases", "libc", - "memoffset", - "pin-utils", ] [[package]] @@ -336,7 +335,7 @@ dependencies = [ "libc", "redox_syscall 0.4.1", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -381,7 +380,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -433,19 +432,19 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "syn" -version = "2.0.48" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -465,9 +464,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -478,7 +477,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -583,7 +582,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.4", ] [[package]] @@ -592,13 +600,28 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +dependencies = [ + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -607,38 +630,80 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" diff --git a/wasm-image/runtimes/native/Cargo.toml b/wasm-image/runtimes/native/Cargo.toml index 5bd0ee32c..9b43b3023 100644 --- a/wasm-image/runtimes/native/Cargo.toml +++ b/wasm-image/runtimes/native/Cargo.toml @@ -11,7 +11,7 @@ tokio-stream = { version="0.1", features=["net"] } simple-logging = "2" log = "0.4" dashmap = "5" -nix = "0.26" +nix = { version="0.28", features=["sched"] } futures-util = "0.3" [profile.release] diff --git a/wasm-image/runtimes/native/src/main.rs b/wasm-image/runtimes/native/src/main.rs index d067a9006..b00088993 100644 --- a/wasm-image/runtimes/native/src/main.rs +++ b/wasm-image/runtimes/native/src/main.rs @@ -1,25 +1,25 @@ -#![feature(async_closure) ] +#![feature(async_closure)] use hyper::service::{make_service_fn, service_fn}; use hyper::{Body, Method, Request, Response, Result, Server, StatusCode}; use futures_util::stream::StreamExt; -use std::process::Stdio; use std::env::args; use std::fs::File; use std::io::Write; use std::os::unix::io::FromRawFd; +use std::process::Stdio; use tokio::io::AsyncReadExt; -use tokio::select; -use tokio::process::Command; use tokio::net::UnixListener; -use tokio_stream::wrappers::UnixListenerStream; +use tokio::process::Command; +use tokio::select; use tokio::signal::unix::{signal, SignalKind}; +use tokio_stream::wrappers::UnixListenerStream; -use nix::unistd::{getpid, fork, ForkResult}; -use nix::sched::{CloneFlags, unshare}; +use nix::sched::{unshare, CloneFlags}; +use nix::unistd::{fork, getpid, ForkResult}; use std::os::unix::net::UnixListener as StdUnixListener; @@ -85,22 +85,25 @@ fn main() { for i in 0..cgroup_count { let fd = 3 + i; - let mut f = unsafe{ File::from_raw_fd(fd) }; + let mut f = unsafe { File::from_raw_fd(fd) }; f.write(format!("{pid}").as_bytes()).unwrap(); log::trace!("Joined cgroup, closing FD {fd}'"); } - unshare(CloneFlags::CLONE_NEWUTS | CloneFlags::CLONE_NEWPID | CloneFlags::CLONE_NEWIPC).unwrap(); + unshare(CloneFlags::CLONE_NEWUTS | CloneFlags::CLONE_NEWPID | CloneFlags::CLONE_NEWIPC) + .unwrap(); - if let ForkResult::Parent{..} = unsafe{ fork().expect("Fork failed") } { + if let ForkResult::Parent { .. } = unsafe { fork().expect("Fork failed") } { std::process::exit(0); } log::debug!("Starting server loop..."); let runtime = tokio::runtime::Builder::new_multi_thread() .worker_threads(1) - .enable_io().build().expect("Failed to start tokio"); + .enable_io() + .build() + .expect("Failed to start tokio"); runtime.block_on(async move { let mut sighandler = signal(SignalKind::terminate()).expect("Failed to install sighandler"); @@ -109,7 +112,8 @@ fn main() { let stream = UnixListenerStream::new(listener); let acceptor = hyper::server::accept::from_stream(stream); - let server = Server::builder(acceptor).serve(make_service) + let server = Server::builder(acceptor) + .serve(make_service) .with_graceful_shutdown(async move { sighandler.recv().await; log::debug!("Got ctrl+c"); @@ -132,10 +136,13 @@ async fn execute_function(args: Vec) -> Result> { let body; let status_code; - let mut child = Command::new("/handler/f.bin").arg(arg_str) - .env("RUST_LOG", "debug") - .stdout(Stdio::piped()).stderr(Stdio::piped()) - .spawn().expect("Failed to spawn lambda process"); + let mut child = Command::new("/handler/f.bin") + .arg(arg_str) + .env("RUST_LOG", "debug") + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("Failed to spawn lambda process"); let child_future = child.wait(); @@ -185,7 +192,7 @@ async fn execute_function(args: Vec) -> Result> { status_code = StatusCode::OK; } Err(err) => { - if err.kind() != std::io::ErrorKind::NotFound { + if err.kind() != std::io::ErrorKind::NotFound { let err_str = format!("Got unexpected error: {err:?}"); log::error!("{err_str}"); @@ -204,10 +211,20 @@ async fn execute_function(args: Vec) -> Result> { let mut stdout = String::from(""); let mut stderr = String::from(""); - child.stdout.take().expect("Failed to get child stdout") - .read_to_string(&mut stdout).await.unwrap(); - child.stderr.take().expect("Failed to get child stderr") - .read_to_string(&mut stderr).await.unwrap(); + child + .stdout + .take() + .expect("Failed to get child stdout") + .read_to_string(&mut stdout) + .await + .unwrap(); + child + .stderr + .take() + .expect("Failed to get child stderr") + .read_to_string(&mut stderr) + .await + .unwrap(); if stdout == "" { log::debug!("Program has no stdout output"); @@ -233,10 +250,7 @@ async fn execute_function(args: Vec) -> Result> { log::trace!("{}", log_line); } - let response = Response::builder() - .status(status_code) - .body(body) - .unwrap(); + let response = Response::builder().status(status_code).body(body).unwrap(); Ok(response) } diff --git a/wasm-worker/Cargo.lock b/wasm-worker/Cargo.lock index 9b4228a04..c436f9bad 100644 --- a/wasm-worker/Cargo.lock +++ b/wasm-worker/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "once_cell", @@ -40,9 +40,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.11" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" dependencies = [ "anstyle", "anstyle-parse", @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2faccea4cc4ab4a667ce676a30e8ec13922a692c99bb8f5b11f1502c72e04220" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" [[package]] name = "arbitrary" @@ -168,9 +168,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" [[package]] name = "byteorder" @@ -186,9 +186,9 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "a0ba8f7aaa012f30d5b2861462f6708eccd49c3c39863fe083a308035f63d723" dependencies = [ "jobserver", "libc", @@ -202,9 +202,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.4.18" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" dependencies = [ "clap_builder", "clap_derive", @@ -212,9 +212,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" dependencies = [ "anstream", "anstyle", @@ -224,9 +224,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck", "proc-macro2", @@ -236,9 +236,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" @@ -386,9 +386,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] @@ -408,9 +408,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.11" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" dependencies = [ "crossbeam-utils", ] @@ -514,9 +514,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "env_logger" @@ -695,15 +695,15 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "http" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -753,9 +753,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" +checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" dependencies = [ "bytes", "futures-channel", @@ -766,6 +766,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", + "smallvec", "tokio", "want", ] @@ -778,9 +779,9 @@ checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" [[package]] name = "indexmap" -version = "2.2.2" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -789,12 +790,12 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix", + "libc", "windows-sys 0.52.0", ] @@ -835,9 +836,9 @@ dependencies = [ [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" dependencies = [ "libc", ] @@ -889,9 +890,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "mach" @@ -928,9 +929,9 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -1025,9 +1026,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "ppv-lite86" @@ -1094,9 +1095,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" +checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" dependencies = [ "either", "rayon-core", @@ -1159,9 +1160,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -1201,9 +1202,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "scopeguard" @@ -1213,15 +1214,15 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "semver" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] @@ -1237,9 +1238,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", @@ -1248,9 +1249,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -1300,12 +1301,12 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1322,15 +1323,15 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" [[package]] name = "syn" -version = "2.0.48" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -1339,9 +1340,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.13" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "termcolor" @@ -1354,18 +1355,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", @@ -1374,9 +1375,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "libc", @@ -1483,9 +1484,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.41.0" +version = "0.201.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e09bca7d6388637d27fb5edbeab11f56bfabcef8743c55ae34370e1e5030a071" +checksum = "b9c7d2731df60006819b013f64ccc2019691deccf6e11a1804bc850cd6748f1a" dependencies = [ "leb128", ] @@ -1813,22 +1814,22 @@ checksum = "9b6060bc082cc32d9a45587c7640e29e3c7b89ada82677ac25d87850aaccb368" [[package]] name = "wast" -version = "70.0.2" +version = "201.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3d5061300042ff5065123dae1e27d00c03f567d34a2937c8472255148a216dc" +checksum = "1ef6e1ef34d7da3e2b374fd2b1a9c0227aff6cad596e1b24df9b58d0f6222faa" dependencies = [ "bumpalo", "leb128", "memchr", "unicode-width", - "wasm-encoder 0.41.0", + "wasm-encoder 0.201.0", ] [[package]] name = "wat" -version = "1.0.85" +version = "1.201.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afd7357b6cc46d46a2509c43dcb1dd4131dafbf4e75562d87017b5a05ffad2d6" +checksum = "453d5b37a45b98dee4f4cb68015fc73634d7883bbef1c65e6e9c78d454cf3f32" dependencies = [ "wast", ] @@ -1879,7 +1880,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.4", ] [[package]] @@ -1899,17 +1900,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -1920,9 +1921,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" @@ -1932,9 +1933,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" @@ -1944,9 +1945,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" @@ -1956,9 +1957,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" @@ -1968,9 +1969,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" @@ -1980,9 +1981,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" @@ -1992,15 +1993,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" [[package]] name = "wit-parser" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df4913a2219096373fd6512adead1fb77ecdaa59d7fc517972a7d30b12f625be" +checksum = "316b36a9f0005f5aa4b03c39bc3728d045df136f8c13a73b7db4510dec725e08" dependencies = [ "anyhow", "id-arena", From 29bb4f14f1f4c9a3ee5df06c3b7515f05f052dc0 Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Thu, 2 May 2024 21:20:59 -0700 Subject: [PATCH 04/23] Better error code handling --- wasm-image/runtimes/native/src/main.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/wasm-image/runtimes/native/src/main.rs b/wasm-image/runtimes/native/src/main.rs index b00088993..4c66910df 100644 --- a/wasm-image/runtimes/native/src/main.rs +++ b/wasm-image/runtimes/native/src/main.rs @@ -1,15 +1,17 @@ #![feature(async_closure)] -use hyper::service::{make_service_fn, service_fn}; -use hyper::{Body, Method, Request, Response, Result, Server, StatusCode}; - -use futures_util::stream::StreamExt; - use std::env::args; use std::fs::File; use std::io::Write; use std::os::unix::io::FromRawFd; use std::process::Stdio; +use std::os::unix::process::ExitStatusExt; +use std::os::unix::net::UnixListener as StdUnixListener; + +use hyper::service::{make_service_fn, service_fn}; +use hyper::{Body, Method, Request, Response, Result, Server, StatusCode}; + +use futures_util::stream::StreamExt; use tokio::io::AsyncReadExt; use tokio::net::UnixListener; @@ -21,8 +23,6 @@ use tokio_stream::wrappers::UnixListenerStream; use nix::sched::{unshare, CloneFlags}; use nix::unistd::{fork, getpid, ForkResult}; -use std::os::unix::net::UnixListener as StdUnixListener; - // Taken from: https://github.com/hyperium/hyper/blob/master/examples/single_threaded.rs #[derive(Clone, Copy, Debug)] struct LocalExec; @@ -166,10 +166,14 @@ async fn execute_function(args: Vec) -> Result> { if status.success() { true - } else { - let exit_code = status.code().unwrap_or(42); - e_str = format!("Function failed with exitcode: {exit_code}"); + } else if let Some(code) = status.code() { + e_str = format!("Function failed with error_code: {code}"); false + } else if let Some(signal) = status.signal() { + e_str = format!("Function failed with signal: {signal}"); + false + } else { + panic!("Function failed for unknown reason"); } } }; From 6c0624ea8a779d112bb487ddf87f818a810db5c2 Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Thu, 2 May 2024 21:37:55 -0700 Subject: [PATCH 05/23] Print stderr as err --- wasm-image/runtimes/native/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasm-image/runtimes/native/src/main.rs b/wasm-image/runtimes/native/src/main.rs index 4c66910df..dacf1ed64 100644 --- a/wasm-image/runtimes/native/src/main.rs +++ b/wasm-image/runtimes/native/src/main.rs @@ -251,7 +251,7 @@ async fn execute_function(args: Vec) -> Result> { log_line += format!(" {}\n", line).as_str(); } - log::trace!("{}", log_line); + log::error!("{}", log_line); } let response = Response::builder().status(status_code).body(body).unwrap(); From 53b093e53fbe368bae26352a86c88de7259e5d54 Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Thu, 2 May 2024 22:10:18 -0700 Subject: [PATCH 06/23] Add get config feature for SOCK --- bin-functions/Cargo.lock | 82 +++++++++++++++++++ bin-functions/bindings/Cargo.toml | 2 + .../src/internal/standalone/config.rs | 27 +++++- src/worker/sandbox/sock.go | 4 +- 4 files changed, 111 insertions(+), 4 deletions(-) diff --git a/bin-functions/Cargo.lock b/bin-functions/Cargo.lock index 3feba319a..2b715deb0 100644 --- a/bin-functions/Cargo.lock +++ b/bin-functions/Cargo.lock @@ -140,6 +140,12 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "flate2" version = "1.0.30" @@ -197,6 +203,12 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + [[package]] name = "hashing" version = "0.1.0" @@ -230,6 +242,16 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown", +] + [[package]] name = "internal-call" version = "0.1.0" @@ -255,6 +277,12 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + [[package]] name = "libc" version = "0.2.154" @@ -322,12 +350,14 @@ dependencies = [ "byte-slice-cast", "bytes", "env_logger", + "lazy_static", "log", "open-lambda-proxy-protocol", "rand", "serde_bytes", "serde_json", "tokio-util", + "toml", "ureq", ] @@ -494,6 +524,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +dependencies = [ + "serde", +] + [[package]] name = "sha2" version = "0.10.8" @@ -564,6 +603,40 @@ dependencies = [ "tracing", ] +[[package]] +name = "toml" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "tracing" version = "0.1.40" @@ -729,3 +802,12 @@ name = "windows_x86_64_msvc" version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + +[[package]] +name = "winnow" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14b9415ee827af173ebb3f15f9083df5a122eb93572ec28741fb153356ea2578" +dependencies = [ + "memchr", +] diff --git a/bin-functions/bindings/Cargo.toml b/bin-functions/bindings/Cargo.toml index e89b5da3a..c956a15a7 100644 --- a/bin-functions/bindings/Cargo.toml +++ b/bin-functions/bindings/Cargo.toml @@ -14,6 +14,8 @@ serde_bytes = "0.11" byte-slice-cast = "1" [target.'cfg(not(target_arch="wasm32"))'.dependencies] +lazy_static = "1" +toml = "0.8" tokio-util = { version="0.7", features=["codec"] } log = "0.4" env_logger = "0.10" diff --git a/bin-functions/bindings/src/internal/standalone/config.rs b/bin-functions/bindings/src/internal/standalone/config.rs index 192dc7375..dc1a02975 100644 --- a/bin-functions/bindings/src/internal/standalone/config.rs +++ b/bin-functions/bindings/src/internal/standalone/config.rs @@ -1,3 +1,26 @@ -pub fn get_config_value(_key: &str) -> Result { - unimplemented!(); +use std::collections::HashMap; +use std::fs::read_to_string; + +use lazy_static::lazy_static; + +fn parse_config_file() -> Result, String> { + let data = read_to_string("/config.toml").map_err(|err| format!("{err}"))?; + toml::from_str(&data).map_err(|err| format!("{err}")) +} + +pub fn get_config_value(key: &str) -> Result { + lazy_static!{ + static ref CONFIG: Result, String> = parse_config_file(); + }; + + match CONFIG.as_ref() { + Ok(config) => { + if let Some(val) = config.get(key) { + Ok(val.clone()) + } else { + Err(format!("No such config entry: {key}")) + } + } + Err(err) => Err(err.clone()) + } } diff --git a/src/worker/sandbox/sock.go b/src/worker/sandbox/sock.go index 6fa14b942..c3f0d4596 100644 --- a/src/worker/sandbox/sock.go +++ b/src/worker/sandbox/sock.go @@ -150,7 +150,7 @@ func (container *SOCKContainer) launchContainerProxy() (err error) { if err != nil { return err } - return fmt.Errorf("container proxy does not seem to be running") + return fmt.Errorf("Container proxy does not seem to be running") default: } @@ -171,7 +171,7 @@ func (container *SOCKContainer) launchContainerProxy() (err error) { } if pid != proc.Pid { - return fmt.Errorf("Database proxy pid does not match") + return fmt.Errorf("Container proxy pid does not match") } pingErr = nil From 9755333786d33c1712fde43ae75bfe5c030b904d Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Thu, 2 May 2024 22:59:51 -0700 Subject: [PATCH 07/23] error handling --- bin-functions/bindings/src/internal/standalone/ipc.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin-functions/bindings/src/internal/standalone/ipc.rs b/bin-functions/bindings/src/internal/standalone/ipc.rs index d729724ce..02abd6db2 100644 --- a/bin-functions/bindings/src/internal/standalone/ipc.rs +++ b/bin-functions/bindings/src/internal/standalone/ipc.rs @@ -16,7 +16,9 @@ pub fn http_get(address: &str, path: &str) -> CallResult { match ureq::get(&url) .call() - .expect("Failed to send request") + .map_err(|err| { + format!("Failed to send request to {url}: {err}") + })? .into_reader() .read_to_end(&mut result) { @@ -31,7 +33,9 @@ pub fn http_post(address: &str, path: &str, args: Vec) -> CallResult { match ureq::post(&url) .send_bytes(&args) - .expect("Failed to send request") + .map_err(|err| { + format!("Failed to send request to {url}: {err}") + })? .into_reader() .read_to_end(&mut result) { From 7cffcf5b702206fe281fa02682ef85404383ec1b Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Thu, 2 May 2024 23:12:24 -0700 Subject: [PATCH 08/23] Url issue --- bin-functions/bindings/src/internal/standalone/ipc.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin-functions/bindings/src/internal/standalone/ipc.rs b/bin-functions/bindings/src/internal/standalone/ipc.rs index 02abd6db2..59a45bf34 100644 --- a/bin-functions/bindings/src/internal/standalone/ipc.rs +++ b/bin-functions/bindings/src/internal/standalone/ipc.rs @@ -11,7 +11,9 @@ pub fn function_call(func_name: S, args: Vec) -> CallResult { } pub fn http_get(address: &str, path: &str) -> CallResult { - let url = format!("{address}/{path}"); + assert!(path.starts_with('/')); + + let url = format!("{address}{path}"); let mut result = vec![]; match ureq::get(&url) @@ -28,7 +30,9 @@ pub fn http_get(address: &str, path: &str) -> CallResult { } pub fn http_post(address: &str, path: &str, args: Vec) -> CallResult { - let url = format!("{address}/{path}"); + assert!(path.starts_with('/')); + + let url = format!("{address}{path}"); let mut result = vec![]; match ureq::post(&url) From 514924a95042ef61a1779080587359b485e79a1d Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Thu, 2 May 2024 23:17:05 -0700 Subject: [PATCH 09/23] Url issue --- bin-functions/bindings/src/internal/standalone/ipc.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin-functions/bindings/src/internal/standalone/ipc.rs b/bin-functions/bindings/src/internal/standalone/ipc.rs index 59a45bf34..1222e387a 100644 --- a/bin-functions/bindings/src/internal/standalone/ipc.rs +++ b/bin-functions/bindings/src/internal/standalone/ipc.rs @@ -13,7 +13,7 @@ pub fn function_call(func_name: S, args: Vec) -> CallResult { pub fn http_get(address: &str, path: &str) -> CallResult { assert!(path.starts_with('/')); - let url = format!("{address}{path}"); + let url = format!("http://{address}{path}"); let mut result = vec![]; match ureq::get(&url) @@ -32,7 +32,7 @@ pub fn http_get(address: &str, path: &str) -> CallResult { pub fn http_post(address: &str, path: &str, args: Vec) -> CallResult { assert!(path.starts_with('/')); - let url = format!("{address}{path}"); + let url = format!("http://{address}{path}"); let mut result = vec![]; match ureq::post(&url) From ded6620b754e0a101c59a1ec9b11ec88671b6131 Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Thu, 2 May 2024 23:21:31 -0700 Subject: [PATCH 10/23] Less printing --- src/worker/sandbox/safeSandbox.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/worker/sandbox/safeSandbox.go b/src/worker/sandbox/safeSandbox.go index 38b6d37b6..ee14cf35d 100644 --- a/src/worker/sandbox/safeSandbox.go +++ b/src/worker/sandbox/safeSandbox.go @@ -76,7 +76,7 @@ func (sb *safeSandbox) destroyOnErr(funcName string, origErr error) { } func (sb *safeSandbox) Destroy(reason string) { - sb.printf("Destroy()") + //sb.printf("Destroy()") t := common.T0("Destroy()") defer t.T1() sb.Mutex.Lock() @@ -118,7 +118,7 @@ func (sb *safeSandbox) DestroyIfPaused(reason string) { } func (sb *safeSandbox) Pause() (err error) { - sb.printf("Pause()") + //sb.printf("Pause()") t := common.T0("Pause()") defer t.T1() sb.Mutex.Lock() @@ -141,7 +141,7 @@ func (sb *safeSandbox) Pause() (err error) { } func (sb *safeSandbox) Unpause() (err error) { - sb.printf("Unpause()") + //sb.printf("Unpause()") t := common.T0("Unpause()") defer t.T1() sb.Mutex.Lock() From e05833f77d71860e5ca7a27b9b26820772bec49f Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Thu, 2 May 2024 23:24:54 -0700 Subject: [PATCH 11/23] Less logging --- wasm-image/runtimes/native/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasm-image/runtimes/native/src/main.rs b/wasm-image/runtimes/native/src/main.rs index dacf1ed64..fa20eec05 100644 --- a/wasm-image/runtimes/native/src/main.rs +++ b/wasm-image/runtimes/native/src/main.rs @@ -138,7 +138,7 @@ async fn execute_function(args: Vec) -> Result> { let mut child = Command::new("/handler/f.bin") .arg(arg_str) - .env("RUST_LOG", "debug") + .env("RUST_LOG", "info") .stdout(Stdio::piped()) .stderr(Stdio::piped()) .spawn() From b7533f6f4b6298dd3adff36bda324a32ba43e246 Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Thu, 16 May 2024 07:02:27 -0700 Subject: [PATCH 12/23] Bump dependencies --- bin-functions/Cargo.lock | 76 +++++++++-------------- container-proxy/Cargo.lock | 45 +++++++------- src/worker/lambda/lambdaFunction.go | 2 +- src/worker/sandbox/sockPool.go | 4 +- wasm-image/runtimes/native/Cargo.lock | 20 +++---- wasm-worker/Cargo.lock | 86 +++++++++++++-------------- 6 files changed, 106 insertions(+), 127 deletions(-) diff --git a/bin-functions/Cargo.lock b/bin-functions/Cargo.lock index 2b715deb0..c49921fa9 100644 --- a/bin-functions/Cargo.lock +++ b/bin-functions/Cargo.lock @@ -79,9 +79,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" [[package]] name = "cfg-if" @@ -397,9 +397,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] @@ -474,21 +474,21 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "serde" -version = "1.0.200" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] @@ -504,9 +504,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.200" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", @@ -515,9 +515,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -526,9 +526,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" dependencies = [ "serde", ] @@ -546,9 +546,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704" dependencies = [ "proc-macro2", "quote", @@ -591,23 +591,22 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] name = "toml" -version = "0.8.12" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" dependencies = [ "serde", "serde_spanned", @@ -617,18 +616,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.12" +version = "0.22.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" +checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" dependencies = [ "indexmap", "serde", @@ -637,25 +636,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", -] - [[package]] name = "typenum" version = "1.17.0" @@ -805,9 +785,9 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b9415ee827af173ebb3f15f9083df5a122eb93572ec28741fb153356ea2578" +checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" dependencies = [ "memchr", ] diff --git a/container-proxy/Cargo.lock b/container-proxy/Cargo.lock index f90d17074..862c7f505 100644 --- a/container-proxy/Cargo.lock +++ b/container-proxy/Cargo.lock @@ -25,9 +25,9 @@ checksum = "9338790e78aa95a416786ec8389546c4b6a1dfc3dc36071ed9518a9413a542eb" [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" @@ -85,9 +85,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" [[package]] name = "cfg-if" @@ -175,9 +175,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -499,9 +499,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] @@ -597,15 +597,15 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "scopeguard" @@ -615,9 +615,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.200" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] @@ -633,9 +633,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.200" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", @@ -644,9 +644,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -722,9 +722,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704" dependencies = [ "proc-macro2", "quote", @@ -829,16 +829,15 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] diff --git a/src/worker/lambda/lambdaFunction.go b/src/worker/lambda/lambdaFunction.go index 270406daa..c08bc614a 100644 --- a/src/worker/lambda/lambdaFunction.go +++ b/src/worker/lambda/lambdaFunction.go @@ -63,7 +63,7 @@ func (f *LambdaFunc) Invoke(w http.ResponseWriter, r *http.Request) { // correspond to which LambdaFuncs func (f *LambdaFunc) printf(format string, args ...any) { msg := fmt.Sprintf(format, args...) - log.Printf("%s [FUNC %s]", strings.TrimRight(msg, "\n"), f.name) + log.Debug("%s [FUNC %s]", strings.TrimRight(msg, "\n"), f.name) } // parseMeta reads in a requirements.txt file that was built from pip-compile diff --git a/src/worker/sandbox/sockPool.go b/src/worker/sandbox/sockPool.go index 34ff8de7a..11bfa2110 100644 --- a/src/worker/sandbox/sockPool.go +++ b/src/worker/sandbox/sockPool.go @@ -185,7 +185,7 @@ func (pool *SOCKPool) Create(parent Sandbox, isLeaf bool, codeDir, scratchDir st return nil, fmt.Errorf("socket path length cannot exceed 108 characters (try moving cluster closer to the root directory") } - log.Printf("Connecting to container at '%s'", sockPath) + log.Debug("Connecting to container at '%s'", sockPath) dial := func(proto, addr string) (net.Conn, error) { return net.Dial("unix", sockPath) } @@ -202,7 +202,7 @@ func (pool *SOCKPool) Create(parent Sandbox, isLeaf bool, codeDir, scratchDir st func (pool *SOCKPool) printf(format string, args ...any) { msg := fmt.Sprintf(format, args...) - log.Printf("%s [SOCK POOL %s]", strings.TrimRight(msg, "\n"), pool.name) + log.Debug("%s [SOCK POOL %s]", strings.TrimRight(msg, "\n"), pool.name) } // handler(...) will be called everytime a sandbox-related event occurs, diff --git a/wasm-image/runtimes/native/Cargo.lock b/wasm-image/runtimes/native/Cargo.lock index ca1a5f018..ece56a2a3 100644 --- a/wasm-image/runtimes/native/Cargo.lock +++ b/wasm-image/runtimes/native/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" @@ -52,9 +52,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" [[package]] name = "cfg-if" @@ -346,9 +346,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] @@ -379,9 +379,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "scopeguard" @@ -436,9 +436,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704" dependencies = [ "proc-macro2", "quote", diff --git a/wasm-worker/Cargo.lock b/wasm-worker/Cargo.lock index 94731807b..9f6ecb3ae 100644 --- a/wasm-worker/Cargo.lock +++ b/wasm-worker/Cargo.lock @@ -89,9 +89,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" [[package]] name = "arbitrary" @@ -112,9 +112,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" @@ -181,9 +181,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" dependencies = [ "jobserver", "libc", @@ -535,9 +535,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -645,9 +645,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -1015,9 +1015,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pin-project-lite" @@ -1045,9 +1045,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] @@ -1184,9 +1184,9 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" @@ -1209,9 +1209,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "scopeguard" @@ -1221,15 +1221,15 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "semver" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.200" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] @@ -1245,9 +1245,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.200" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", @@ -1256,9 +1256,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -1336,9 +1336,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.60" +version = "2.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704" dependencies = [ "proc-macro2", "quote", @@ -1362,18 +1362,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" +checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" +checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" dependencies = [ "proc-macro2", "quote", @@ -1491,9 +1491,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.206.0" +version = "0.207.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d759312e1137f199096d80a70be685899cd7d3d09c572836bb2e9b69b4dc3b1e" +checksum = "d996306fb3aeaee0d9157adbe2f670df0236caf19f6728b221e92d0f27b3fe17" dependencies = [ "leb128", ] @@ -1821,22 +1821,22 @@ checksum = "9b6060bc082cc32d9a45587c7640e29e3c7b89ada82677ac25d87850aaccb368" [[package]] name = "wast" -version = "206.0.0" +version = "207.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68586953ee4960b1f5d84ebf26df3b628b17e6173bc088e0acfbce431469795a" +checksum = "0e40be9fd494bfa501309487d2dc0b3f229be6842464ecbdc54eac2679c84c93" dependencies = [ "bumpalo", "leb128", "memchr", "unicode-width", - "wasm-encoder 0.206.0", + "wasm-encoder 0.207.0", ] [[package]] name = "wat" -version = "1.206.0" +version = "1.207.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da4c6f2606276c6e991aebf441b2fc92c517807393f039992a3e0ad873efe4ad" +checksum = "8eb2b15e2d5f300f5e1209e7dc237f2549edbd4203655b6c6cab5cf180561ee7" dependencies = [ "wast", ] @@ -2030,18 +2030,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", From 3045912584d535cee50b036b1abd75669819e355 Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Fri, 27 Dec 2024 15:43:43 -0800 Subject: [PATCH 13/23] Update hyper --- Makefile | 10 +- container-proxy/rust-toolchain.toml | 2 +- scripts/helper/__init__.py | 19 +- scripts/test.py | 3 + wasm-image/runtimes/native/Cargo.lock | 174 ++------- wasm-image/runtimes/native/Cargo.toml | 13 +- .../runtimes/native/rust-toolchain.toml | 2 + wasm-image/runtimes/native/src/main.rs | 366 +++++++++--------- wasm-worker/rust-toolchain.toml | 2 +- 9 files changed, 257 insertions(+), 334 deletions(-) create mode 100644 wasm-image/runtimes/native/rust-toolchain.toml diff --git a/Makefile b/Makefile index 9d5ced706..6f4677889 100644 --- a/Makefile +++ b/Makefile @@ -82,11 +82,11 @@ sudo-install: build sudo cp ol-container-proxy ${INSTALL_PREFIX}/bin/ test-all: - sudo python3 -u ./scripts/test.py --worker_type=sock - sudo python3 -u ./scripts/test.py --worker_type=docker --test_filter=ping_test,numpy - sudo python3 -u ./scripts/sock_test.py - sudo python3 -u ./scripts/bin_test.py --worker_type=wasm - sudo python3 -u ./scripts/bin_test.py --worker_type=sock + python3 -u ./scripts/test.py --worker_type=sock + python3 -u ./scripts/test.py --worker_type=docker --test_filter=ping_test,numpy + python3 -u ./scripts/sock_test.py + python3 -u ./scripts/bin_test.py --worker_type=wasm + python3 -u ./scripts/bin_test.py --worker_type=sock fmt: #cd src && go fmt ... diff --git a/container-proxy/rust-toolchain.toml b/container-proxy/rust-toolchain.toml index d192c61f4..fb6a2638f 100644 --- a/container-proxy/rust-toolchain.toml +++ b/container-proxy/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel="nightly-2024-11-05" +channel="nightly-2024-12-16" diff --git a/scripts/helper/__init__.py b/scripts/helper/__init__.py index 463c51969..a0ed790dd 100644 --- a/scripts/helper/__init__.py +++ b/scripts/helper/__init__.py @@ -138,7 +138,7 @@ def __init__(self): try: print("Starting Docker container worker") - run(['./ol', 'worker', 'up', f'-p={_OL_DIR}', '--detach']) + run(['sudo', './ol', 'worker', 'up', f'-p={_OL_DIR}', '--detach']) except Exception as err: raise RuntimeError(f"failed to start worker: {err}") from err @@ -166,7 +166,7 @@ def stop(self): try: print("Stopping Docker container worker") - run(['./ol', 'worker', 'down', '-p='+_OL_DIR]) + run(['sudo', './ol', 'worker', 'down', '-p='+_OL_DIR]) except Exception as err: raise RuntimeError("Failed to start worker") from err @@ -179,7 +179,7 @@ def __init__(self): try: print("Starting SOCK container worker") - run(['./ol', 'worker', 'up', '-p='+_OL_DIR, '--detach']) + run(['sudo', './ol', 'worker', 'up', '-p='+_OL_DIR, '--detach']) except Exception as err: raise RuntimeError(f"failed to start worker: {err}") from err @@ -203,14 +203,15 @@ def stop(self): if self.is_running(): self._running = False else: - return # Already stopped + return # Already stopped try: print("Stopping SOCK container worker") - run(['./ol', 'worker', 'down', '-p='+_OL_DIR]) + run(['sudo', './ol', 'worker', 'down', '-p='+_OL_DIR]) except Exception as err: raise RuntimeError("Failed to start worker") from err + class WasmWorker(): ''' Runs OpenLambda's WebAssembly worker ''' @@ -254,6 +255,7 @@ def stop(self): self._process.terminate() self._process = None + def prepare_open_lambda(ol_dir): ''' Sets up the working director for open lambda, @@ -263,6 +265,7 @@ def prepare_open_lambda(ol_dir): # (except for the base "lambda" dir) run(['./ol', 'worker', 'init', f'-p={ol_dir}']) + def mounts(): ''' Returns a list of all mounted directories ''' @@ -271,6 +274,7 @@ def mounts(): output = output.split("\n") return set(output) + def ol_oom_killer(): ''' Will terminate OpenLambda if we run out of memory ''' @@ -280,6 +284,7 @@ def ol_oom_killer(): os.system('pkill ol') sleep(1) + def get_mem_stat_mb(stat): ''' Get the current memory usage in MB ''' with open('/proc/meminfo', 'r', encoding='utf-8') as memfile: @@ -290,8 +295,10 @@ def get_mem_stat_mb(stat): return int(parts[1]) / 1024 raise ValueError('could not get stat') + def assert_eq(actual, expected): ''' Test helper. Will fail if actual != expected ''' if expected != actual: - raise ValueError(f'Expected value "{expected}", but was "{actual}"') + raise ValueError(f'Expected value "{expected}", ' + f'but was "{actual}"') diff --git a/scripts/test.py b/scripts/test.py index 9e31ebab4..c9321af3e 100755 --- a/scripts/test.py +++ b/scripts/test.py @@ -24,6 +24,7 @@ # These will be set by argparse in main() OL_DIR = None + @test def install_tests(): # we want to make sure we see the expected number of pip installs, @@ -59,10 +60,12 @@ def install_tests(): # requests (and deps) + simplejson assert_eq(installs, 6) + def check_status_code(req): if req.status_code != 200: raise requests.HTTPError(f"STATUS {req.status_code}: {req.text}") + @test def numpy_test(): open_lambda = OpenLambda() diff --git a/wasm-image/runtimes/native/Cargo.lock b/wasm-image/runtimes/native/Cargo.lock index b16849047..deca6d419 100644 --- a/wasm-image/runtimes/native/Cargo.lock +++ b/wasm-image/runtimes/native/Cargo.lock @@ -58,22 +58,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cfg_aliases" -version = "0.1.1" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" - -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown", - "lock_api", - "once_cell", - "parking_lot_core", -] +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "fnv" @@ -133,17 +120,11 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - [[package]] name = "http" -version = "0.2.12" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -152,12 +133,24 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.6" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", + "futures-util", "http", + "http-body", "pin-project-lite", ] @@ -175,13 +168,12 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", "http", "http-body", @@ -189,11 +181,23 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "smallvec", + "tokio", +] + +[[package]] +name = "hyper-util" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", "tokio", - "tower-service", - "tracing", - "want", ] [[package]] @@ -214,16 +218,6 @@ version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - [[package]] name = "log" version = "0.4.22" @@ -258,9 +252,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ "bitflags", "cfg-if", @@ -277,37 +271,19 @@ dependencies = [ "memchr", ] -[[package]] -name = "once_cell" -version = "1.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" - [[package]] name = "open-lambda-runtime" version = "0.1.0" dependencies = [ - "dashmap", "futures-util", + "http-body-util", "hyper", + "hyper-util", "log", "nix", + "pin-project-lite", "simple-logging", "tokio", - "tokio-stream", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.5.8", - "smallvec", - "windows-targets", ] [[package]] @@ -346,27 +322,12 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -[[package]] -name = "redox_syscall" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" -dependencies = [ - "bitflags", -] - [[package]] name = "rustc-demangle" version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -430,7 +391,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" dependencies = [ "libc", - "redox_syscall 0.1.57", + "redox_syscall", "winapi", ] @@ -462,63 +423,12 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" -dependencies = [ - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" -dependencies = [ - "once_cell", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - [[package]] name = "unicode-ident" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/wasm-image/runtimes/native/Cargo.toml b/wasm-image/runtimes/native/Cargo.toml index 9b43b3023..4ba3e5547 100644 --- a/wasm-image/runtimes/native/Cargo.toml +++ b/wasm-image/runtimes/native/Cargo.toml @@ -1,18 +1,21 @@ +cargo-features=["edition2024"] + [package] name = "open-lambda-runtime" version = "0.1.0" authors = ["Kai Mast "] -edition = "2018" +edition = "2024" [dependencies] tokio = { version="1", features=["net", "io-util", "rt-multi-thread", "macros", "signal", "process"] } -hyper = { version="0.14", features=["server", "http1", "runtime", "stream"] } -tokio-stream = { version="0.1", features=["net"] } +hyper = { version="1", features=["server", "http1"] } simple-logging = "2" log = "0.4" -dashmap = "5" -nix = { version="0.28", features=["sched"] } +nix = { version="0.29", features=["sched"] } futures-util = "0.3" +pin-project-lite = "0.2" +http-body-util = "0.1" +hyper-util = { version="0.1", features=["tokio"] } [profile.release] debug = true diff --git a/wasm-image/runtimes/native/rust-toolchain.toml b/wasm-image/runtimes/native/rust-toolchain.toml new file mode 100644 index 000000000..fb6a2638f --- /dev/null +++ b/wasm-image/runtimes/native/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel="nightly-2024-12-16" diff --git a/wasm-image/runtimes/native/src/main.rs b/wasm-image/runtimes/native/src/main.rs index fa20eec05..dcdb7d855 100644 --- a/wasm-image/runtimes/native/src/main.rs +++ b/wasm-image/runtimes/native/src/main.rs @@ -1,70 +1,187 @@ -#![feature(async_closure)] +#![feature(impl_trait_in_assoc_type)] use std::env::args; use std::fs::File; use std::io::Write; use std::os::unix::io::FromRawFd; -use std::process::Stdio; -use std::os::unix::process::ExitStatusExt; use std::os::unix::net::UnixListener as StdUnixListener; +use std::os::unix::process::ExitStatusExt; +use std::process::Stdio; -use hyper::service::{make_service_fn, service_fn}; -use hyper::{Body, Method, Request, Response, Result, Server, StatusCode}; +use hyper::body::{Bytes, Incoming}; +use hyper::server::conn::http1; +use hyper::{Method, Request, Response, StatusCode}; -use futures_util::stream::StreamExt; +use http_body_util::{BodyExt, Full}; use tokio::io::AsyncReadExt; use tokio::net::UnixListener; use tokio::process::Command; use tokio::select; -use tokio::signal::unix::{signal, SignalKind}; -use tokio_stream::wrappers::UnixListenerStream; - -use nix::sched::{unshare, CloneFlags}; -use nix::unistd::{fork, getpid, ForkResult}; - -// Taken from: https://github.com/hyperium/hyper/blob/master/examples/single_threaded.rs -#[derive(Clone, Copy, Debug)] -struct LocalExec; - -impl hyper::rt::Executor for LocalExec -where - F: std::future::Future + 'static, // not requiring `Send` -{ - fn execute(&self, fut: F) { - // This will spawn into the currently running `LocalSet`. - tokio::task::spawn_local(fut); +use tokio::signal::unix::{SignalKind, signal}; + +use nix::sched::{CloneFlags, unshare}; +use nix::unistd::{ForkResult, fork, getpid}; + +use hyper_util::rt::tokio::TokioIo; + +struct Service {} + +impl hyper::service::Service> for Service { + type Response = Response>; + type Error = hyper::Error; + type Future = impl std::future::Future>>>; + + fn call(&self, req: Request) -> Self::Future { + Self::handle_request(req) } } -fn main() { - let make_service = make_service_fn(async move |_| { - Ok::<_, hyper::Error>(service_fn(async move |req: Request| { - log::trace!("Got new request: {req:?}"); +impl Service { + async fn handle_request(req: Request) -> hyper::Result>> { + log::trace!("Got new request: {req:?}"); + + let method = req.method().clone(); + let args = req.collect().await?.to_bytes().to_vec(); + + if method == Method::POST { + Self::execute_function(args).await + } else { + panic!("Got unexpected request"); + } + } + + async fn execute_function(args: Vec) -> hyper::Result>> { + use std::io::Read; + + let arg_str = String::from_utf8(args).unwrap(); + log::debug!("Executing function with arg `{arg_str}`"); + + let status_code; + + let mut child = Command::new("/handler/f.bin") + .arg(arg_str) + .env("RUST_LOG", "info") + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("Failed to spawn lambda process"); + + let child_future = child.wait(); + + let mut sighandler = signal(SignalKind::terminate()).expect("Failed to install sighandler"); + let sig_future = sighandler.recv(); + + log::debug!("Waiting for process to terminate or signal"); - let mut args = Vec::new(); - let method = req.method().clone(); + let error = select! { + _ = sig_future => { + log::info!("Got ctrl+c"); + child.kill().await.expect("Failed to kill child"); + child.wait().await.unwrap(); - let mut body = req.into_body(); + std::process::exit(0); + } + res = child_future => { + let status = res.unwrap(); + + if status.success() { + None + } else if let Some(code) = status.code() { + Some(format!("Function failed with error_code: {code}")) + } else if let Some(signal) = status.signal() { + Some(format!("Function failed with signal: {signal}")) + } else { + panic!("Function failed for unknown reason"); + } + } + }; + + let body = if let Some(err_str) = error { + status_code = StatusCode::INTERNAL_SERVER_ERROR; + log::error!("{err_str}"); + err_str + } else { + log::debug!("Function returned successfully"); + + match File::open("/tmp/output") { + Ok(mut f) => { + let mut jstr = String::new(); + f.read_to_string(&mut jstr).unwrap(); - while let Some(chunk) = body.next().await { - match chunk { - Ok(c) => { - let mut chunk = c.to_vec(); - args.append(&mut chunk); + log::debug!("Got response: {jstr}"); + + status_code = StatusCode::OK; + jstr + } + Err(err) => { + if err.kind() != std::io::ErrorKind::NotFound { + let err_str = format!("Got unexpected error: {err:?}"); + log::error!("{err_str}"); + + status_code = StatusCode::INTERNAL_SERVER_ERROR; + err_str + } else { + log::debug!("Function did not give a response"); + + status_code = StatusCode::OK; + String::default() } - Err(err) => panic!("Got error: {:?}", err), } } + }; + + let mut stdout = String::default(); + let mut stderr = String::default(); + + child + .stdout + .take() + .expect("Failed to get child stdout") + .read_to_string(&mut stdout) + .await + .unwrap(); + child + .stderr + .take() + .expect("Failed to get child stderr") + .read_to_string(&mut stderr) + .await + .unwrap(); + + if stdout.is_empty() { + log::debug!("Program has no stdout output"); + } else { + let mut log_line = String::from("Process stdout:\n"); + + for line in stdout.split('\n') { + log_line += format!(" {line}\n").as_str(); + } + + log::trace!("{log_line}"); + } + if stderr.is_empty() { + log::debug!("Program has no stderr output"); + } else { + let mut log_line = String::from("Process stderr:\n"); - if method == &Method::POST { - execute_function(args).await - } else { - panic!("Got unexpected request"); + for line in stderr.split('\n') { + log_line += format!(" {}\n", line).as_str(); } - })) - }); + log::error!("{log_line}"); + } + + let response = Response::builder() + .status(status_code) + .body(body.into()) + .unwrap(); + + Ok(response) + } +} + +fn main() { if let Err(err) = simple_logging::log_to_file("/host/ol-runtime.log", log::LevelFilter::Info) { println!("Failed to create logfile: {err}"); } @@ -87,7 +204,7 @@ fn main() { let fd = 3 + i; let mut f = unsafe { File::from_raw_fd(fd) }; - f.write(format!("{pid}").as_bytes()).unwrap(); + f.write_all(format!("{pid}").as_bytes()).unwrap(); log::trace!("Joined cgroup, closing FD {fd}'"); } @@ -106,155 +223,36 @@ fn main() { .expect("Failed to start tokio"); runtime.block_on(async move { - let mut sighandler = signal(SignalKind::terminate()).expect("Failed to install sighandler"); - - let listener = UnixListener::from_std(listener).unwrap(); - let stream = UnixListenerStream::new(listener); - let acceptor = hyper::server::accept::from_stream(stream); + let mut sigterm = signal(SignalKind::terminate()).expect("Failed to install sighandler"); - let server = Server::builder(acceptor) - .serve(make_service) - .with_graceful_shutdown(async move { - sighandler.recv().await; - log::debug!("Got ctrl+c"); - }); + let accept_task = tokio::spawn(async move { + let listener = UnixListener::from_std(listener).unwrap(); - log::info!("Listening on unix:{socket_path}"); + log::info!("Listening on unix:{socket_path}"); - if let Err(err) = server.await { - log::error!("server error: {err}"); - } - }); -} - -async fn execute_function(args: Vec) -> Result> { - use std::io::Read; - - let arg_str = String::from_utf8(args).unwrap(); - log::debug!("Executing function with arg `{arg_str}`"); - - let body; - let status_code; - - let mut child = Command::new("/handler/f.bin") - .arg(arg_str) - .env("RUST_LOG", "info") - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn() - .expect("Failed to spawn lambda process"); - - let child_future = child.wait(); - - let mut sighandler = signal(SignalKind::terminate()).expect("Failed to install sighandler"); - let sig_future = sighandler.recv(); - - let mut e_str = String::from(""); - - log::debug!("Waiting for process to terminate or signal"); + while let Ok((conn, _addr)) = listener.accept().await { + let service = Service {}; + let conn = TokioIo::new(conn); - let success = select! { - _ = sig_future => { - log::info!("Got ctrl+c"); - child.kill().await.expect("Failed to kill child"); - child.wait().await.unwrap(); - - std::process::exit(0); - } - res = child_future => { - let status = res.unwrap(); - - if status.success() { - true - } else if let Some(code) = status.code() { - e_str = format!("Function failed with error_code: {code}"); - false - } else if let Some(signal) = status.signal() { - e_str = format!("Function failed with signal: {signal}"); - false - } else { - panic!("Function failed for unknown reason"); - } - } - }; - - if !success { - status_code = StatusCode::INTERNAL_SERVER_ERROR; - log::error!("{e_str}"); - body = e_str.into(); - } else { - log::debug!("Function returned successfully"); - - match File::open("/tmp/output") { - Ok(mut f) => { - let mut jstr = String::new(); - f.read_to_string(&mut jstr).unwrap(); - - log::debug!("Got response: {jstr}"); - - body = Body::from(jstr); - status_code = StatusCode::OK; + if let Err(http_err) = http1::Builder::new() + .keep_alive(true) + .serve_connection(conn, service) + .await + { + log::error!("Error while serving HTTP connection: {http_err}"); + } } - Err(err) => { - if err.kind() != std::io::ErrorKind::NotFound { - let err_str = format!("Got unexpected error: {err:?}"); - log::error!("{err_str}"); + }); - body = Body::from(err_str); - status_code = StatusCode::INTERNAL_SERVER_ERROR; + tokio::select! { + _result = accept_task => {} + result = sigterm.recv() => { + if result.is_none() { + log::error!("Failed to receive signal. Shutting down."); } else { - log::debug!("Function did not give a response"); - - body = Body::empty(); - status_code = StatusCode::OK; + log::info!("Received SIGTERM. Shutting down gracefully..."); } } } - } - - let mut stdout = String::from(""); - let mut stderr = String::from(""); - - child - .stdout - .take() - .expect("Failed to get child stdout") - .read_to_string(&mut stdout) - .await - .unwrap(); - child - .stderr - .take() - .expect("Failed to get child stderr") - .read_to_string(&mut stderr) - .await - .unwrap(); - - if stdout == "" { - log::debug!("Program has no stdout output"); - } else { - let mut log_line = String::from("Process stdout:\n"); - - for line in stdout.split('\n') { - log_line += format!(" {}\n", line).as_str(); - } - - log::trace!("{}", log_line); - } - - if stderr == "" { - log::debug!("Program has no stderr output"); - } else { - let mut log_line = String::from("Process stderr:\n"); - - for line in stderr.split('\n') { - log_line += format!(" {}\n", line).as_str(); - } - - log::error!("{}", log_line); - } - - let response = Response::builder().status(status_code).body(body).unwrap(); - - Ok(response) + }); } diff --git a/wasm-worker/rust-toolchain.toml b/wasm-worker/rust-toolchain.toml index d192c61f4..fb6a2638f 100644 --- a/wasm-worker/rust-toolchain.toml +++ b/wasm-worker/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel="nightly-2024-11-05" +channel="nightly-2024-12-16" From 9e74b8f934094908cff141da4294862fc0aa7c5f Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Fri, 27 Dec 2024 16:12:36 -0800 Subject: [PATCH 14/23] Lint --- .github/workflows/ci.yml | 2 +- golint.toml | 4 ++++ src/bench/bench.go | 1 + src/boss/autoscaling/scaling.go | 2 ++ src/common/stats.go | 2 +- src/common/storage.go | 8 ++++---- src/main.go | 1 + src/worker/embedded/embedded.go | 5 ++--- src/worker/event/sockServer.go | 2 +- src/worker/sandbox/dockerPool.go | 2 +- src/worker/sandbox/safeSandbox.go | 8 ++++---- src/worker/sandbox/sockPool.go | 6 +++--- 12 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5938a82cf..4997ce105 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - name: Install pylint run: pip3 install pylint==2.15.0 - name: Install revive (go linter) - run: go install github.com/mgechev/revive@v1.3.4 + run: go install github.com/mgechev/revive@latest - name: Install cross run: cargo install cross - name: Build OpenLambda diff --git a/golint.toml b/golint.toml index cf5ad1d3d..8a144f65a 100644 --- a/golint.toml +++ b/golint.toml @@ -21,6 +21,10 @@ errorCode = 2 [rule.superfluous-else] severity = "error" +[rule.package-comments] + Disabled = true +[rule.unchecked-type-assertion] + Disabled = true [rule.defer] Disabled = true [rule.empty-block] diff --git a/src/bench/bench.go b/src/bench/bench.go index 120cace52..1b48185b3 100644 --- a/src/bench/bench.go +++ b/src/bench/bench.go @@ -1,3 +1,4 @@ +// Package bench implements benchmarking functionality for OpenLambda package bench import ( diff --git a/src/boss/autoscaling/scaling.go b/src/boss/autoscaling/scaling.go index 6e4cea7b9..e1bc08700 100644 --- a/src/boss/autoscaling/scaling.go +++ b/src/boss/autoscaling/scaling.go @@ -1,3 +1,5 @@ +// Package autoscaling provides the interface for different +// implementations of the scaling logic package autoscaling import "github.com/open-lambda/open-lambda/ol/boss/cloudvm" diff --git a/src/common/stats.go b/src/common/stats.go index 5d3781627..bacdfcc1a 100644 --- a/src/common/stats.go +++ b/src/common/stats.go @@ -117,7 +117,7 @@ func (l *Latency) T1() { // make sure we didn't double record var zero time.Time - if l.t0 == zero { + if l.t0.Equal(zero) { panic("double counted stat for " + l.name) } l.t0 = zero diff --git a/src/common/storage.go b/src/common/storage.go index 561968fa5..14c5dc92a 100644 --- a/src/common/storage.go +++ b/src/common/storage.go @@ -17,10 +17,10 @@ const ( STORE_MEMORY ) -var BIND uintptr = uintptr(syscall.MS_BIND) -var BIND_RO uintptr = uintptr(syscall.MS_BIND | syscall.MS_RDONLY | syscall.MS_REMOUNT) -var PRIVATE uintptr = uintptr(syscall.MS_PRIVATE) -var SHARED uintptr = uintptr(syscall.MS_SHARED) +var BIND = uintptr(syscall.MS_BIND) +var BIND_RO = uintptr(syscall.MS_BIND | syscall.MS_RDONLY | syscall.MS_REMOUNT) +var PRIVATE = uintptr(syscall.MS_PRIVATE) +var SHARED = uintptr(syscall.MS_SHARED) var nextDirId int64 = 1000 diff --git a/src/main.go b/src/main.go index 0c8c1a169..45999b246 100644 --- a/src/main.go +++ b/src/main.go @@ -1,3 +1,4 @@ +// Package main is entry point for the `ol` command package main import ( diff --git a/src/worker/embedded/embedded.go b/src/worker/embedded/embedded.go index c172044e1..eb1095822 100644 --- a/src/worker/embedded/embedded.go +++ b/src/worker/embedded/embedded.go @@ -1,10 +1,9 @@ +// Package embedded lets us include some Python code and other files directly inside +// the binary so that ol is a standalone deployable. package embedded import _ "embed" -// This lets us embed some Python code and other files directly inside -// the binary so that ol is a standalone deployable. - // Default tree of 40 Zygotes nodes (with nodes for Pandas, etc) //go:embed default-zygotes-40.json diff --git a/src/worker/event/sockServer.go b/src/worker/event/sockServer.go index b94441d73..3a7e9fa4e 100644 --- a/src/worker/event/sockServer.go +++ b/src/worker/event/sockServer.go @@ -199,7 +199,7 @@ func (server *SOCKServer) Handle(w http.ResponseWriter, r *http.Request) { // cleanup cleans up the SOCK server. func (server *SOCKServer) cleanup() { - server.sandboxes.Range(func(key, val any) bool { + server.sandboxes.Range(func(_, val any) bool { val.(sandbox.Sandbox).Destroy("SOCKServer cleanup") return true }) diff --git a/src/worker/sandbox/dockerPool.go b/src/worker/sandbox/dockerPool.go index b5ac961ee..ee7ecd8dd 100644 --- a/src/worker/sandbox/dockerPool.go +++ b/src/worker/sandbox/dockerPool.go @@ -144,7 +144,7 @@ func (pool *DockerPool) Create(parent Sandbox, isLeaf bool, codeDir, scratchDir return nil, fmt.Errorf("socket path length cannot exceed 108 characters (try moving cluster closer to the root directory") } - dial := func(proto, addr string) (net.Conn, error) { + dial := func(_, _ string) (net.Conn, error) { return net.Dial("unix", sockPath) } diff --git a/src/worker/sandbox/safeSandbox.go b/src/worker/sandbox/safeSandbox.go index ee14cf35d..8015eb746 100644 --- a/src/worker/sandbox/safeSandbox.go +++ b/src/worker/sandbox/safeSandbox.go @@ -76,7 +76,7 @@ func (sb *safeSandbox) destroyOnErr(funcName string, origErr error) { } func (sb *safeSandbox) Destroy(reason string) { - //sb.printf("Destroy()") + // sb.printf("Destroy()") t := common.T0("Destroy()") defer t.T1() sb.Mutex.Lock() @@ -98,7 +98,7 @@ func (sb *safeSandbox) Destroy(reason string) { } func (sb *safeSandbox) DestroyIfPaused(reason string) { - sb.printf("DestroyIfPaused()") + // sb.printf("DestroyIfPaused()") t := common.T0("DestroyIfPaused()") defer t.T1() sb.Mutex.Lock() @@ -118,7 +118,7 @@ func (sb *safeSandbox) DestroyIfPaused(reason string) { } func (sb *safeSandbox) Pause() (err error) { - //sb.printf("Pause()") + // :b.printf("Pause()") t := common.T0("Pause()") defer t.T1() sb.Mutex.Lock() @@ -141,7 +141,7 @@ func (sb *safeSandbox) Pause() (err error) { } func (sb *safeSandbox) Unpause() (err error) { - //sb.printf("Unpause()") + // sb.printf("Unpause()") t := common.T0("Unpause()") defer t.T1() sb.Mutex.Lock() diff --git a/src/worker/sandbox/sockPool.go b/src/worker/sandbox/sockPool.go index 11bfa2110..8d34f60aa 100644 --- a/src/worker/sandbox/sockPool.go +++ b/src/worker/sandbox/sockPool.go @@ -185,8 +185,8 @@ func (pool *SOCKPool) Create(parent Sandbox, isLeaf bool, codeDir, scratchDir st return nil, fmt.Errorf("socket path length cannot exceed 108 characters (try moving cluster closer to the root directory") } - log.Debug("Connecting to container at '%s'", sockPath) - dial := func(proto, addr string) (net.Conn, error) { + log.Printf("Connecting to container at '%s'", sockPath) + dial := func(_, _ string) (net.Conn, error) { return net.Dial("unix", sockPath) } @@ -202,7 +202,7 @@ func (pool *SOCKPool) Create(parent Sandbox, isLeaf bool, codeDir, scratchDir st func (pool *SOCKPool) printf(format string, args ...any) { msg := fmt.Sprintf(format, args...) - log.Debug("%s [SOCK POOL %s]", strings.TrimRight(msg, "\n"), pool.name) + log.Printf("%s [SOCK POOL %s]", strings.TrimRight(msg, "\n"), pool.name) } // handler(...) will be called everytime a sandbox-related event occurs, From 078c65b84f13e9c9ddbbc3c9f44d9317d921cb60 Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Fri, 27 Dec 2024 16:20:45 -0800 Subject: [PATCH 15/23] Bump pylint --- .github/workflows/ci.yml | 2 +- src/worker/lambda/lambdaFunction.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4997ce105..a003d2358 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: with: python-version: '3.12' - name: Install pylint - run: pip3 install pylint==2.15.0 + run: pip3 install pylint==3.3.3 - name: Install revive (go linter) run: go install github.com/mgechev/revive@latest - name: Install cross diff --git a/src/worker/lambda/lambdaFunction.go b/src/worker/lambda/lambdaFunction.go index a7c089c17..b8acc3fb5 100644 --- a/src/worker/lambda/lambdaFunction.go +++ b/src/worker/lambda/lambdaFunction.go @@ -64,7 +64,7 @@ func (f *LambdaFunc) Invoke(w http.ResponseWriter, r *http.Request) { // correspond to which LambdaFuncs func (f *LambdaFunc) printf(format string, args ...any) { msg := fmt.Sprintf(format, args...) - log.Debug("%s [FUNC %s]", strings.TrimRight(msg, "\n"), f.name) + log.Printf("%s [FUNC %s]", strings.TrimRight(msg, "\n"), f.name) } // parseMeta reads in a requirements.txt file that was built from pip-compile From 70f0c5acdfada3ff6fe14d37bc19ced2238363e9 Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Fri, 27 Dec 2024 16:36:24 -0800 Subject: [PATCH 16/23] Specify revive version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a003d2358..47a862d48 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - name: Install pylint run: pip3 install pylint==3.3.3 - name: Install revive (go linter) - run: go install github.com/mgechev/revive@latest + run: go install github.com/mgechev/revive@1.5.1 - name: Install cross run: cargo install cross - name: Build OpenLambda From 9902346e73dd893242d315a05d3618372e98531d Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Fri, 27 Dec 2024 16:40:49 -0800 Subject: [PATCH 17/23] Re-enable print statement --- src/worker/sandbox/safeSandbox.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/worker/sandbox/safeSandbox.go b/src/worker/sandbox/safeSandbox.go index 8015eb746..cdc377fd4 100644 --- a/src/worker/sandbox/safeSandbox.go +++ b/src/worker/sandbox/safeSandbox.go @@ -98,7 +98,7 @@ func (sb *safeSandbox) Destroy(reason string) { } func (sb *safeSandbox) DestroyIfPaused(reason string) { - // sb.printf("DestroyIfPaused()") + sb.printf("DestroyIfPaused()") t := common.T0("DestroyIfPaused()") defer t.T1() sb.Mutex.Lock() @@ -118,7 +118,7 @@ func (sb *safeSandbox) DestroyIfPaused(reason string) { } func (sb *safeSandbox) Pause() (err error) { - // :b.printf("Pause()") + sb.printf("Pause()") t := common.T0("Pause()") defer t.T1() sb.Mutex.Lock() @@ -141,7 +141,7 @@ func (sb *safeSandbox) Pause() (err error) { } func (sb *safeSandbox) Unpause() (err error) { - // sb.printf("Unpause()") + sb.printf("Unpause()") t := common.T0("Unpause()") defer t.T1() sb.Mutex.Lock() From ff6e4758fdac9afbf740127cac2306a24ad08ca4 Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Fri, 27 Dec 2024 16:49:41 -0800 Subject: [PATCH 18/23] Cleanup ol-wasm docker file better --- wasm-image/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wasm-image/Dockerfile b/wasm-image/Dockerfile index d6ce87b66..5e2b91c51 100644 --- a/wasm-image/Dockerfile +++ b/wasm-image/Dockerfile @@ -3,13 +3,17 @@ FROM ol-min RUN apt-get -y install clang # Setup rust environment (prereq for native runtime) -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2023-12-01 +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2024-12-16 # Build Native Runtime in the Container RUN mkdir /runtimes/native COPY runtimes/native /tmp/native-runtime RUN cd /tmp/native-runtime && ~/.cargo/bin/cargo build --release RUN mv /tmp/native-runtime/target/release/open-lambda-runtime /runtimes/native/server + +# Remove build files to reduce image size RUN rm -rf /tmp/native-runtime +RUN rm -rf ~/.cargo +RUN rm -rf ~/.rustup CMD ["/spin"] From 71a0a4c6825dc912f25edbff1dc72c40a005744c Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Fri, 27 Dec 2024 16:51:10 -0800 Subject: [PATCH 19/23] Typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47a862d48..9d14ddc8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - name: Install pylint run: pip3 install pylint==3.3.3 - name: Install revive (go linter) - run: go install github.com/mgechev/revive@1.5.1 + run: go install github.com/mgechev/revive@v1.5.1 - name: Install cross run: cargo install cross - name: Build OpenLambda From 0c9ccd231643352a173025c7d2b4fcca5af8212a Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Fri, 27 Dec 2024 17:10:23 -0800 Subject: [PATCH 20/23] Revert "Re-enable print statement" This reverts commit 9902346e73dd893242d315a05d3618372e98531d. --- src/worker/sandbox/safeSandbox.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/worker/sandbox/safeSandbox.go b/src/worker/sandbox/safeSandbox.go index cdc377fd4..8015eb746 100644 --- a/src/worker/sandbox/safeSandbox.go +++ b/src/worker/sandbox/safeSandbox.go @@ -98,7 +98,7 @@ func (sb *safeSandbox) Destroy(reason string) { } func (sb *safeSandbox) DestroyIfPaused(reason string) { - sb.printf("DestroyIfPaused()") + // sb.printf("DestroyIfPaused()") t := common.T0("DestroyIfPaused()") defer t.T1() sb.Mutex.Lock() @@ -118,7 +118,7 @@ func (sb *safeSandbox) DestroyIfPaused(reason string) { } func (sb *safeSandbox) Pause() (err error) { - sb.printf("Pause()") + // :b.printf("Pause()") t := common.T0("Pause()") defer t.T1() sb.Mutex.Lock() @@ -141,7 +141,7 @@ func (sb *safeSandbox) Pause() (err error) { } func (sb *safeSandbox) Unpause() (err error) { - sb.printf("Unpause()") + // sb.printf("Unpause()") t := common.T0("Unpause()") defer t.T1() sb.Mutex.Lock() From d5370dcf71e0f5dc45d41280696bf3da4498f03a Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Fri, 27 Dec 2024 19:48:19 -0800 Subject: [PATCH 21/23] Prevent segfault during ol worker force-cleanup --- src/worker/helpers.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/worker/helpers.go b/src/worker/helpers.go index c0890cd93..9b150af25 100644 --- a/src/worker/helpers.go +++ b/src/worker/helpers.go @@ -186,6 +186,7 @@ const ( // This function returns the current state of OpenLambda, the PID if possible, // and an error if it encounters any. func checkState() (OlState, error) { + olPath := common.Conf.Worker_dir dirStat, err := os.Stat(olPath) if os.IsNotExist(err) { @@ -395,6 +396,11 @@ func stoppedDirtyToStoppedClean(olPath string) error { // bringToStoppedClean tries the best to bring the state of OpenLambda to StoppedClean no mater which state it is in. func bringToStoppedClean(olPath string) error { + err := common.LoadConf(filepath.Join(olPath, "config.json")) + if err != nil { + return fmt.Errorf("failed to load OL config: %s", err) + } + state, err := checkState() if err != nil { return fmt.Errorf("failed to check OL state: %s", err) From 8fc315b22f33f732a4a23402c81931ffff56f9de Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Fri, 27 Dec 2024 19:56:32 -0800 Subject: [PATCH 22/23] Move LoadConf into cleanup command --- src/worker/commands.go | 4 ++++ src/worker/helpers.go | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/worker/commands.go b/src/worker/commands.go index 517547fe8..ef8af6142 100644 --- a/src/worker/commands.go +++ b/src/worker/commands.go @@ -229,6 +229,10 @@ func cleanupCmd(ctx *cli.Context) error { if err != nil { return err } + err = common.LoadConf(filepath.Join(olPath, "config.json")) + if err != nil { + return fmt.Errorf("failed to load OL config: %s", err) + } return bringToStoppedClean(olPath) } diff --git a/src/worker/helpers.go b/src/worker/helpers.go index 9b150af25..5e6010c30 100644 --- a/src/worker/helpers.go +++ b/src/worker/helpers.go @@ -186,6 +186,9 @@ const ( // This function returns the current state of OpenLambda, the PID if possible, // and an error if it encounters any. func checkState() (OlState, error) { + if common.Conf == nil { + panic("Invalid state: config not initialized"); + } olPath := common.Conf.Worker_dir dirStat, err := os.Stat(olPath) @@ -396,11 +399,6 @@ func stoppedDirtyToStoppedClean(olPath string) error { // bringToStoppedClean tries the best to bring the state of OpenLambda to StoppedClean no mater which state it is in. func bringToStoppedClean(olPath string) error { - err := common.LoadConf(filepath.Join(olPath, "config.json")) - if err != nil { - return fmt.Errorf("failed to load OL config: %s", err) - } - state, err := checkState() if err != nil { return fmt.Errorf("failed to check OL state: %s", err) From 87cb0309507a8959172fa022cfaa7901bf9e6e8d Mon Sep 17 00:00:00 2001 From: Kai Mast Date: Fri, 27 Dec 2024 20:01:06 -0800 Subject: [PATCH 23/23] Formatting --- src/main.go | 12 ++++++------ src/worker/helpers.go | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main.go b/src/main.go index 45999b246..51d700fb6 100644 --- a/src/main.go +++ b/src/main.go @@ -225,8 +225,8 @@ func pprofCpuStop(ctx *cli.Context) error { if response.StatusCode == 400 { return fmt.Errorf("Should call \"ol pprof cpu-start\" first\n") } else if response.StatusCode == 500 { - return fmt.Errorf("Unknown server error\n") - } + return fmt.Errorf("Unknown server error\n") + } path := ctx.String("out") if path == "" { @@ -374,17 +374,17 @@ OPTIONS: Name: "cpu-start", Usage: "Starts CPU profiling", UsageText: "ol pprof cpu-start ", - Action: pprofCpuStart, + Action: pprofCpuStart, }, { Name: "cpu-stop", Usage: "Stops CPU profiling if started", UsageText: "ol pprof cpu-stop [--out=NAME]", - Action: pprofCpuStop, + Action: pprofCpuStop, Flags: []cli.Flag{ &cli.StringFlag{ - Name: "out", - Aliases: []string{"o"}, + Name: "out", + Aliases: []string{"o"}, }, }, }, diff --git a/src/worker/helpers.go b/src/worker/helpers.go index 5e6010c30..56ffe91bb 100644 --- a/src/worker/helpers.go +++ b/src/worker/helpers.go @@ -186,9 +186,9 @@ const ( // This function returns the current state of OpenLambda, the PID if possible, // and an error if it encounters any. func checkState() (OlState, error) { - if common.Conf == nil { - panic("Invalid state: config not initialized"); - } + if common.Conf == nil { + panic("Invalid state: config not initialized"); + } olPath := common.Conf.Worker_dir dirStat, err := os.Stat(olPath)