Stream: git-wasmtime

Topic: wasmtime / issue #8269 `wasi::http::outgoing_handler::han...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2024 at 01:42):

kaivol added the bug label to Issue #8269.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 31 2024 at 01:42):

kaivol opened issue #8269:

Test Case

Call wasi::http::outgoing_handler::handle with an invalid argument (e.g., path_with_query not set):

use wasi::http::outgoing_handler::{handle, OutgoingRequest};
use wasi::http::types::{Fields, Method, Scheme};

fn main() {
    let fields = Fields::new();
    let req = OutgoingRequest::new(fields);
    req.set_method(&Method::Get).unwrap();
    req.set_scheme(Some(&Scheme::Https)).unwrap();
    req.set_authority(Some("example.com")).unwrap();
    // Don't set path/query
    // req.set_path_with_query(Some("/")).unwrap();

    let res = handle(req, None);
    println!("{res:?}");
}

Steps to Reproduce

Expected Results

handle should return an error, which then gets printed by the WASM component.

Actual Results

handle crashes the wasmtime runtime immediately, and the component code doesn't get a chance to handle the error:

Error: failed to run main module `.\target\wasm32-wasi\debug\wasmtime_demo.wasm`

Caused by:
    0: failed to invoke `run` function
    1: error while executing at wasm backtrace:
           0: 0x291982 - wit-component:shim!indirect-wasi:http/outgoing-handler@0.2.0-handle
           1: 0x5c27 - <unknown>!wasi::bindings::wasi::http::outgoing_handler::handle::h243762d529a071e2
           2: 0x2287 - <unknown>!wasmtime_demo::main::h6a3dfdd89fcbbb62
           3: 0x1e9a - <unknown>!core::ops::function::FnOnce::call_once::hef7075ed4fc37c5f
           4: 0x18ff - <unknown>!std::sys_common::backtrace::__rust_begin_short_backtrace::ha7ad02d581d2e631
           5: 0x1878 - <unknown>!std::rt::lang_start::{{closure}}::h298ac82840374e7e
           6: 0xf239 - <unknown>!std::rt::lang_start_internal::h11043ae9961d0df9
           7: 0x1814 - <unknown>!std::rt::lang_start::ha68b6582d347d4c9
           8: 0x2384 - <unknown>!__main_void
           9: 0x16d6 - <unknown>!_start
          10: 0x28dae9 - wit-component:adapter:wasi_snapshot_preview1!wasi:cli/run@0.2.0#run
       note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information
    2: ErrorCode::HttpProtocolError

Versions and Environment

Wasmtime version or commit: 19.0.0

Operating system: Windows 11

Architecture: x64

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2024 at 01:29):

elliottt closed issue #8269:

Test Case

Call wasi::http::outgoing_handler::handle with an invalid argument (e.g., path_with_query not set):

use wasi::http::outgoing_handler::{handle, OutgoingRequest};
use wasi::http::types::{Fields, Method, Scheme};

fn main() {
    let fields = Fields::new();
    let req = OutgoingRequest::new(fields);
    req.set_method(&Method::Get).unwrap();
    req.set_scheme(Some(&Scheme::Https)).unwrap();
    req.set_authority(Some("example.com")).unwrap();
    // Don't set path/query
    // req.set_path_with_query(Some("/")).unwrap();

    let res = handle(req, None);
    println!("{res:?}");
}

Steps to Reproduce

Expected Results

handle should return an error, which then gets printed by the WASM component.

Actual Results

handle crashes the wasmtime runtime immediately, and the component code doesn't get a chance to handle the error:

Error: failed to run main module `.\target\wasm32-wasi\debug\wasmtime_demo.wasm`

Caused by:
    0: failed to invoke `run` function
    1: error while executing at wasm backtrace:
           0: 0x291982 - wit-component:shim!indirect-wasi:http/outgoing-handler@0.2.0-handle
           1: 0x5c27 - <unknown>!wasi::bindings::wasi::http::outgoing_handler::handle::h243762d529a071e2
           2: 0x2287 - <unknown>!wasmtime_demo::main::h6a3dfdd89fcbbb62
           3: 0x1e9a - <unknown>!core::ops::function::FnOnce::call_once::hef7075ed4fc37c5f
           4: 0x18ff - <unknown>!std::sys_common::backtrace::__rust_begin_short_backtrace::ha7ad02d581d2e631
           5: 0x1878 - <unknown>!std::rt::lang_start::{{closure}}::h298ac82840374e7e
           6: 0xf239 - <unknown>!std::rt::lang_start_internal::h11043ae9961d0df9
           7: 0x1814 - <unknown>!std::rt::lang_start::ha68b6582d347d4c9
           8: 0x2384 - <unknown>!__main_void
           9: 0x16d6 - <unknown>!_start
          10: 0x28dae9 - wit-component:adapter:wasi_snapshot_preview1!wasi:cli/run@0.2.0#run
       note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information
    2: ErrorCode::HttpProtocolError

Versions and Environment

Wasmtime version or commit: 19.0.0

Operating system: Windows 11

Architecture: x64


Last updated: Oct 23 2024 at 20:03 UTC