StarlingMonkey icon indicating copy to clipboard operation
StarlingMonkey copied to clipboard

Outbound request error - `out of bounds memory access`

Open karthik2804 opened this issue 1 year ago • 0 comments

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

...
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

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 - <unknown>!std::__2::unique_ptr<unsigned char [], std::__2::default_delete<unsigned char []>>::release[abi:v160000]()
           1: 0x26acd - <unknown>!std::__2::unique_ptr<unsigned char [], std::__2::default_delete<unsigned char []>>::unique_ptr[abi:v160000](std::__2::unique_ptr<unsigned char [], std::__2::default_delete<unsigned char []>>&&)
           2: 0x38989 - <unknown>!host_api::HostBytes::HostBytes(host_api::HostBytes&&)
           3: 0xfed24 - <unknown>!host_api::HostBytes* std::__2::construct_at[abi:v160000]<host_api::HostBytes, host_api::HostBytes, host_api::HostBytes*>(host_api::HostBytes*, host_api::HostBytes&&)
           4: 0xfe744 - <unknown>!void std::__2::allocator_traits<std::__2::allocator<host_api::HostBytes>>::construct[abi:v160000]<host_api::HostBytes, host_api::HostBytes, void, void>(std::__2::allocator<host_api::HostBytes>&, host_api::HostBytes*, host_api::HostBytes&&)
           5: 0xff31e - <unknown>!std::__2::reverse_iterator<host_api::HostBytes*> std::__2::__uninitialized_allocator_move_if_noexcept[abi:v160000]<std::__2::allocator<host_api::HostBytes>, std::__2::reverse_iterator<host_api::HostBytes*>, std::__2::reverse_iterator<host_api::HostBytes*>, std::__2::reverse_iterator<host_api::HostBytes*>>(std::__2::allocator<host_api::HostBytes>&, std::__2::reverse_iterator<host_api::HostBytes*>, std::__2::reverse_iterator<host_api::HostBytes*>, std::__2::reverse_iterator<host_api::HostBytes*>)
           6: 0xfeb14 - <unknown>!std::__2::vector<host_api::HostBytes, std::__2::allocator<host_api::HostBytes>>::__swap_out_circular_buffer(std::__2::__split_buffer<host_api::HostBytes, std::__2::allocator<host_api::HostBytes>&>&)
           7: 0xfdfed - <unknown>!void std::__2::vector<host_api::HostBytes, std::__2::allocator<host_api::HostBytes>>::__emplace_back_slow_path<host_api::HostBytes>(host_api::HostBytes&&)
           8: 0xed20e - <unknown>!host_api::HostBytes& std::__2::vector<host_api::HostBytes, std::__2::allocator<host_api::HostBytes>>::emplace_back<host_api::HostBytes>(host_api::HostBytes&&)
           9: 0xecce7 - <unknown>!builtins::web::fetch::(anonymous namespace)::read_from_handle_all(JSContext*, host_api::HttpIncomingBody*)
          10: 0xec85c - <unknown>!builtins::web::fetch::RequestOrResponse::consume_body_handle_for_bodyAll(JSContext*, JS::Handle<JSObject*>, JS::Handle<JS::Value>, JS::CallArgs)
          11: 0x103afc - <unknown>!bool internal_method<&builtins::web::fetch::RequestOrResponse::consume_body_handle_for_bodyAll(JSContext*, JS::Handle<JSObject*>, JS::Handle<JS::Value>, JS::CallArgs)>(JSContext*, unsigned int, JS::Value*)
          12: 0x26ebd9 - <unknown>!CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&)
          13: 0x26e409 - <unknown>!js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason)
          14: 0x26fefb - <unknown>!InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason)
          15: 0x270256 - <unknown>!js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason)
          16: 0x2e8647 - <unknown>!js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::MutableHandle<JS::Value>)
          17: 0x4fe029 - <unknown>!PromiseReactionJob(JSContext*, unsigned int, JS::Value*)
          18: 0x26ebd9 - <unknown>!CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&)
          19: 0x26e409 - <unknown>!js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason)
          20: 0x26fefb - <unknown>!InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason)
          21: 0x270256 - <unknown>!js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason)
          22: 0x3a7f26 - <unknown>!JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>)
          23: 0x457828 - <unknown>!js::InternalJobQueue::runJobs(JSContext*)
          24: 0x4571e0 - <unknown>!js::RunJobs(JSContext*)
          25: 0x20200 - <unknown>!core::EventLoop::run_event_loop(api::Engine*, double, JS::MutableHandle<JS::Value>)
          26: 0x1d198 - <unknown>!api::Engine::run_event_loop(JS::MutableHandle<JS::Value>)
          27: 0x10acea - <unknown>!exports_wasi_http_0_2_0_incoming_handler_handle
          28: 0x4c156 - <unknown>!__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    

karthik2804 avatar Feb 10 '24 19:02 karthik2804