bytecodealliance / bytecodealliance/StarlingMonkey

Outbound request error - `out of bounds memory access`

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
288
Forks
57
PR merge metrics
No merged PRs in 30d

Description

I was attempting to send an outbound request to `https://echo.free.beeceptor.com` by modifying `tests/smoke.js`

```javascript
...
let p = fetch("https://example.com");
let test = fetch("https://echo.free.beeceptor.com")
// let p2 = fetch(url);
// let resolve, reject;
let responsePromise = new Promise(async (res, rej) => {
resolve = res;
reject = rej;
});
event.respondWith(responsePromise);
let temp = await test
console.log(await temp.text())
let response = await p;
// console.log(response);
...
```

Running the program results in

```bash
RUST_LOG=spin_trigger_http=trace spin up
Logging component stdio to ".spin/logs/"
2024-02-10T19:33:37.736324Z TRACE spin_trigger_http: Constructed router for application js-component: [(Wildcard(""), "js-component")]

Serving http://127.0.0.1:3000
2024-02-10T19:33:37.736441Z INFO spin_trigger_http: Serving http://127.0.0.1:3000
Available Routes:
js-component: http://127.0.0.1:3000 (wildcard)
2024-02-10T19:33:39.768995Z INFO spin_trigger_http: Processing request for application js-component on URI http://127.0.0.1:3000/
2024-02-10T19:33:39.769027Z TRACE spin_trigger_http::handler: Executing request using the Spin executor for component js-component
2024-02-10T19:35:41.517198Z TRACE spin_trigger_http::handler: wasi-http memory consumed: 2154889216
2024-02-10T19:35:41.543521Z ERROR spin_trigger_http: Error processing request: guest invocation failed

Caused by:
0: error while executing at wasm backtrace:
0: 0x3239e - !std::__2::unique_ptr>::release[abi:v160000]()
1: 0x26acd - !std::__2::unique_ptr>::unique_ptr[abi:v160000](std::__2::unique_ptr>&&)
2: 0x38989 - !host_api::HostBytes::HostBytes(host_api::HostBytes&&)
3: 0xfed24 - !host_api::HostBytes* std::__2::construct_at[abi:v160000](host_api::HostBytes*, host_api::HostBytes&&)
4: 0xfe744 - !void std::__2::allocator_traits>::construct[abi:v160000](std::__2::allocator&, host_api::HostBytes*, host_api::HostBytes&&)
5: 0xff31e - !std::__2::reverse_iterator std::__2::__uninitialized_allocator_move_if_noexcept[abi:v160000], std::__2::reverse_iterator, std::__2::reverse_iterator, std::__2::reverse_iterator>(std::__2::allocator&, std::__2::reverse_iterator, std::__2::reverse_iterator, std::__2::reverse_iterator)
6: 0xfeb14 - !std::__2::vector>::__swap_out_circular_buffer(std::__2::__split_buffer&>&)
7: 0xfdfed - !void std::__2::vector>::__emplace_back_slow_path(host_api::HostBytes&&)
8: 0xed20e - !host_api::HostBytes& std::__2::vector>::emplace_back(host_api::HostBytes&&)
9: 0xecce7 - !builtins::web::fetch::(anonymous namespace)::read_from_handle_all(JSContext*, host_api::HttpIncomingBody*)
10: 0xec85c - !builtins::web::fetch::RequestOrResponse::consume_body_handle_for_bodyAll(JSContext*, JS::Handle, JS::Handle, JS::CallArgs)
11: 0x103afc - !bool internal_method<&builtins::web::fetch::RequestOrResponse::consume_body_handle_for_bodyAll(JSContext*, JS::Handle, JS::Handle, JS::CallArgs)>(JSContext*, unsigned int, JS::Value*)
12: 0x26ebd9 - !CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&)
13: 0x26e409 - !js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason)
14: 0x26fefb - !InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason)
15: 0x270256 - !js::Call(JSContext*, JS::Handle, JS::Handle, js::AnyInvokeArgs const&, JS::MutableHandle, js::CallReason)
16: 0x2e8647 - !js::Call(JSContext*, JS::Handle, JS::Handle, JS::Handle, JS::MutableHandle)
17: 0x4fe029 - !PromiseReactionJob(JSContext*, unsigned int, JS::Value*)
18: 0x26ebd9 - !CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&)
19: 0x26e409 - !js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason)
20: 0x26fefb - !InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason)
21: 0x270256 - !js::Call(JSContext*, JS::Handle, JS::Handle, js::AnyInvokeArgs const&, JS::MutableHandle, js::CallReason)
22: 0x3a7f26 - !JS::Call(JSContext*, JS::Handle, JS::Handle, JS::HandleValueArray const&, JS::MutableHandle)
23: 0x457828 - !js::InternalJobQueue::runJobs(JSContext*)
24: 0x4571e0 - !js::RunJobs(JSContext*)
25: 0x20200 - !core::EventLoop::run_event_loop(api::Engine*, double, JS::MutableHandle)
26: 0x1d198 - !api::Engine::run_event_loop(JS::MutableHandle)
27: 0x10acea - !exports_wasi_http_0_2_0_incoming_handler_handle
28: 0x4c156 - !__wasm_export_exports_wasi_http_0_2_0_incoming_handler_handle
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information
1: memory fault at wasm address 0xfffffff0 in linear memory of size 0x80710000
2: wasm trap: out of bounds memory access
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.