-
Notifications
You must be signed in to change notification settings - Fork 123
deps: bump wasmtime to 43.0.1 #1106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tanishiking
wants to merge
2
commits into
containerd:main
Choose a base branch
from
tanishiking:wasmtime43
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,11 +11,12 @@ use tokio_util::sync::CancellationToken; | |
| use wasmtime::component::types::ComponentItem; | ||
| use wasmtime::component::{self, Component, ResourceTable}; | ||
| use wasmtime::{Config, Module, Precompiled, Store}; | ||
| use wasmtime_wasi::p1::{self as wasi_p1, WasiP1Ctx}; | ||
| use wasmtime_wasi::p2::bindings::Command; | ||
| use wasmtime_wasi::preview1::{self as wasi_preview1, WasiP1Ctx}; | ||
| use wasmtime_wasi::{WasiCtx, WasiCtxBuilder, WasiCtxView, WasiView}; | ||
| use wasmtime_wasi_http::bindings::ProxyPre; | ||
| use wasmtime_wasi_http::{WasiHttpCtx, WasiHttpView}; | ||
| use wasmtime_wasi_http::WasiHttpCtx; | ||
| use wasmtime_wasi_http::p2::bindings::ProxyPre; | ||
| use wasmtime_wasi_http::p2::{WasiHttpCtxView, WasiHttpView}; | ||
|
|
||
| use crate::http_proxy::serve_conn; | ||
|
|
||
|
|
@@ -67,7 +68,6 @@ impl Default for WasmtimeSandbox { | |
| // see https://github.com/containerd/runwasi/pull/405#issuecomment-1928468714 for details | ||
| config.parallel_compilation(!cfg!(test)); | ||
| config.wasm_component_model(true); // enable component linking | ||
| config.async_support(true); // must be on | ||
|
|
||
| if use_pooling_allocator_by_default() { | ||
| let cfg = wasmtime::PoolingAllocationConfig::default(); | ||
|
|
@@ -76,6 +76,7 @@ impl Default for WasmtimeSandbox { | |
|
|
||
| Self { | ||
| engine: wasmtime::Engine::new(&config) | ||
| .map_err(anyhow::Error::from) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In wasmtime 43 |
||
| .context("failed to create wasmtime engine") | ||
| .unwrap(), | ||
| cancel: CancellationToken::new(), | ||
|
|
@@ -111,12 +112,12 @@ impl WasiView for WasiPreview2Ctx { | |
| } | ||
|
|
||
| impl WasiHttpView for WasiPreview2Ctx { | ||
| fn ctx(&mut self) -> &mut wasmtime_wasi_http::WasiHttpCtx { | ||
| &mut self.wasi_http | ||
| } | ||
|
|
||
| fn table(&mut self) -> &mut ResourceTable { | ||
| &mut self.resource_table | ||
| fn http(&mut self) -> WasiHttpCtxView<'_> { | ||
| WasiHttpCtxView { | ||
| ctx: &mut self.wasi_http, | ||
| table: &mut self.resource_table, | ||
| hooks: Default::default(), | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -139,7 +140,6 @@ impl Shim for WasmtimeShim { | |
| // see https://github.com/containerd/runwasi/pull/405#issuecomment-1928468714 for details | ||
| config.parallel_compilation(!cfg!(test)); | ||
| config.wasm_component_model(true); // enable component linking | ||
| config.async_support(true); // must be on | ||
|
|
||
| let engine = wasmtime::Engine::new(&config) | ||
| .expect("failed to create wasmtime precompilation engine"); | ||
|
|
@@ -214,9 +214,7 @@ impl WasmtimeSandbox { | |
| let mut module_linker = wasmtime::Linker::new(&self.engine); | ||
|
|
||
| log::debug!("init linker"); | ||
| wasi_preview1::add_to_linker_async(&mut module_linker, |wasi_ctx: &mut WasiP1Ctx| { | ||
| wasi_ctx | ||
| })?; | ||
| wasi_p1::add_to_linker_async(&mut module_linker, |wasi_ctx: &mut WasiP1Ctx| wasi_ctx)?; | ||
|
|
||
| log::info!("instantiating instance"); | ||
| let instance: wasmtime::Instance = | ||
|
|
@@ -232,6 +230,7 @@ impl WasmtimeSandbox { | |
| start_func | ||
| .call_async(&mut store, &[], &mut []) | ||
| .await | ||
| .map_err(anyhow::Error::from) | ||
| .into_error_code() | ||
| } | ||
|
|
||
|
|
@@ -254,7 +253,7 @@ impl WasmtimeSandbox { | |
| log::info!("Found HTTP proxy target"); | ||
| let mut linker = component::Linker::new(&self.engine); | ||
| wasmtime_wasi::p2::add_to_linker_async(&mut linker)?; | ||
| wasmtime_wasi_http::add_only_http_to_linker_async(&mut linker)?; | ||
| wasmtime_wasi_http::p2::add_only_http_to_linker_async(&mut linker)?; | ||
|
|
||
| let pre = linker.instantiate_pre(&component)?; | ||
| log::info!("pre-instantiate_pre"); | ||
|
|
@@ -295,7 +294,10 @@ impl WasmtimeSandbox { | |
| ))?; | ||
|
|
||
| log::debug!("running exported function {func:?} {start_func:?}"); | ||
| start_func.call_async(&mut store, &[], &mut []).await | ||
| start_func | ||
| .call_async(&mut store, &[], &mut []) | ||
| .await | ||
| .map_err(anyhow::Error::from) | ||
| } | ||
| }; | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| [toolchain] | ||
| channel="1.86.0" | ||
| channel="1.91.0" | ||
| profile="default" | ||
| targets = ["wasm32-wasip1"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasmtime-wasi 43.0.1 requires
url >= 2.5.7, andwasmer-package0.600.1 pins url=2.5.2.Updated them so it relax to
url = ^2.5.