Skip to content
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

wasm engine panic for ProtectedData #176

Open
cataggar opened this issue Dec 31, 2024 · 3 comments
Open

wasm engine panic for ProtectedData #176

cataggar opened this issue Dec 31, 2024 · 3 comments

Comments

@cataggar
Copy link
Contributor

I'm still trying to wrap typescript compiler in a component, but I'm currently stuck on a wasm engine panic. I'm using a local debug build in order to get a wasm backtrace bytecodealliance/jco#537 (comment). I'm having a hard time deciphering the backtrace. The full output is attached. I'll attach steps to reproduce soon.

~/ms/StarlingMonkey15> bun run build.ts
$ wkg wit fetch

$ cargo component build
  Generating bindings for typescript-system (src/bindings.rs)
   Compiling typescript-system v0.1.0 (/Users/cataggar/ms/StarlingMonkey15/typescript-system)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.79s
    Creating component target/wasm32-wasip1/debug/typescript_system.wasm

$ wkg wit fetch

$ bunx jco types wit -o .

  Generated Type Files:

 - ./interfaces/ts-typescript-system-types.d.ts   1.4 KiB
 - ./interfaces/ts-typescript-typescript.d.ts    1.31 KiB
 - ./wit.d.ts                                    0.22 KiB


$ bun run bundle.ts

$ bunx jco componentize world.js --wit wit -o ts-typescript.wasm -d clocks -d random -d http
OK Successfully written ts-typescript.wasm.

$ wkg wit fetch

$ cargo component build
  Generating bindings for test-rs (src/bindings.rs)
   Compiling test-rs v0.1.0 (/Users/cataggar/ms/StarlingMonkey15/test-rs)
warning: unused variable: `program`
  --> src/main.rs:14:9
   |
14 |     let program = ts::create_program2(&programOptions)?;
   |         ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_program`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: variable `compilerOptions` should have a snake case name
  --> src/main.rs:12:9
   |
12 |     let compilerOptions = ts::CompilerOptions::new();
   |         ^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `compiler_options`
   |
   = note: `#[warn(non_snake_case)]` on by default

warning: variable `programOptions` should have a snake case name
  --> src/main.rs:13:9
   |
13 |     let programOptions = ts::CreateProgramOptions::new(&["abc.ts".to_string()], &compilerOptions);
   |         ^^^^^^^^^^^^^^ help: convert the identifier to snake case: `program_options`

warning: `test-rs` (bin "test-rs") generated 3 warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.24s
    Creating component target/wasm32-wasip1/debug/test-rs.wasm

$ wac plug target/wasm32-wasip1/debug/test-rs.wasm -o target/test.wasm --plug ../typescript/ts-typescript.wasm

$ wac plug target/test.wasm -o target/test2.wasm --plug ../typescript-system/target/wasm32-wasip1/debug/typescript_system.wasm

$ WASMTIME_BACKTRACE_DETAILS=1 wasmtime run --dir .::/ test-rs/target/test2.wasm a b c
Error: failed to run main module `test-rs/target/test2.wasm`

Caused by:
    0: failed to invoke `run` function
    1: error while executing at wasm backtrace:
           0: 0x83c055 - js::ProtectedData<js::CheckMainThread<(js::AllowedHelperThread)1>, double>::ProtectedData<>(&&)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/threading/ProtectedData.h:83:9              - js::ProtectedDataNoCheckArgs<js::CheckMainThread<(js::AllowedHelperThread)1>, double>::ProtectedDataNoCheckArgs<>()
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/threading/ProtectedData.h:176:9              - js::gc::GCSchedulingTunables::GCSchedulingTunables()
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/gc/Scheduling.cpp:161:23
           1: 0x464dbd - JS::MutableHandle<JS::Value>::set(JS::Value const&)
                           at /Users/cataggar/ms/ComponentizeJS/StarlingMonkey/deps/cpm_cache/spidermonkey-release/a38f6dcef1c55853420221f55b4ead18fb1fa14d/spidermonkey-release/include/js/RootingAPI.h:706:10              - js::MutableWrappedPtrOperations<JS::Value, JS::MutableHandle<JS::Value> >::set(JS::Value const&)
                           at /Users/cataggar/ms/ComponentizeJS/StarlingMonkey/deps/cpm_cache/spidermonkey-release/a38f6dcef1c55853420221f55b4ead18fb1fa14d/spidermonkey-release/include/js/Value.h:1452:34              - js::MutableWrappedPtrOperations<JS::Value, JS::MutableHandle<JS::Value> >::setInt32(int)
                           at /Users/cataggar/ms/ComponentizeJS/StarlingMonkey/deps/cpm_cache/spidermonkey-release/a38f6dcef1c55853420221f55b4ead18fb1fa14d/spidermonkey-release/include/js/Value.h:1458:30              - componentize::embedding::ReallocFn(JSContext*, unsigned int, JS::Value*)
                           at /Users/cataggar/ms/ComponentizeJS/embedding/embedding.cpp:453:15
           2: 0x496773 - JS::Realm::zone()
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Realm.h:460:29              - JSContext::setRealm(JS::Realm*)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSContext-inl.h:342:20              - JSContext::leaveRealm(JS::Realm*)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSContext-inl.h:325:3              - js::AutoRealm::~AutoRealm()
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Realm-inl.h:71:36              - CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Interpreter.cpp:493:1              - js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Interpreter.cpp:581:12
           3: 0x4971b1 - js::gc::HeaderWord::get() const
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/gc/Cell.h:106:23              - js::gc::CellWithTenuredGCPointer<js::gc::Cell, js::Shape>::headerPtr() const
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/gc/Cell.h:799:60              - JSObject::shape() const
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSObject.h:93:37              - JSObject::getClass() const
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSObject.h:114:44              - bool JSObject::is<JSFunction>() const
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSFunction.h:915:10              - JSObject::isConstructor() const
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSObject-inl.h:581:7              - js::IsConstructor(JS::Value const&)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSObject-inl.h:555:39              - StackCheckIsConstructorCalleeNewTarget(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Interpreter.cpp:736:8              - js::ConstructFromStack(JSContext*, JS::CallArgs const&, js::CallReason)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Interpreter.cpp:751:8
           4: 0x4978c2 - JS::Value::Value()
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/obj-release/dist/include/js/Value.h:555:23              - JS::ValueArray<(unsigned long)3>::ValueArray()
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/obj-release/dist/include/js/ValueArray.h:31:8              - JS::SafelyInitialized<JS::ValueArray<(unsigned long)3>, void>::create()
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/obj-release/dist/include/js/RootingAPI.h:250:12              - JS::Rooted<JS::ValueArray<(unsigned long)3> >::Rooted<JSContext*, JSContext*>()
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/obj-release/dist/include/js/RootingAPI.h:1182:13              - js::detail::FixedArgsBase<(js::MaybeConstruct)0, (unsigned long)1>::FixedArgsBase(JSContext*)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Stack.h:903:43              - js::FixedInvokeArgs<(unsigned long)1>::FixedInvokeArgs(JSContext*)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Stack.h:945:45              - js::CallSetter(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::Handle<JS::Value>)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Interpreter.cpp:807:22
           5: 0x5c488d - bool NativeGetPropertyInline<(js::AllowGC)1>(JSContext*, js::MaybeRooted<js::NativeObject*, (js::AllowGC)1>::HandleType, js::MaybeRooted<JS::Value, (js::AllowGC)1>::HandleType, js::MaybeRooted<JS::PropertyKey, (js::AllowGC)1>::HandleType, IsNameLookup, js::MaybeRooted<JS::Value, (js::AllowGC)1>::MutableHandleType)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/obj-release/dist/include/js/RootingAPI.h:706:10              - js::NativeGetProperty(JSContext*, JS::Handle<js::NativeObject*>, JS::Handle<JS::Value>, JS::Handle<JS::PropertyKey>, JS::MutableHandle<JS::Value>)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/NativeObject.cpp:2350:10
           6: 0x49a823 - <unknown>!js::GetProperty(JSContext*, JS::Handle<JS::Value>, JS::Handle<js::PropertyName*>, JS::MutableHandle<JS::Value>)
           7: 0x48f0d4 - JS::Rooted<js::PropertyName*>::set(js::PropertyName*&&)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/obj-release/dist/include/js/RootingAPI.h:1226:9              - JS::Rooted<js::PropertyName*>::operator=(js::PropertyName*&&)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/obj-release/dist/include/js/RootingAPI.h:1231:3              - js::ReservedRooted<js::PropertyName*>::~ReservedRooted()
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Interpreter-inl.h:983:34              - js::Interpret(JSContext*, js::RunState&)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Interpreter.cpp:2950:5
           8: 0x489986 - js::RunScript(JSContext*, js::RunState&)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/obj-release/dist/include/mozilla/TimeStamp.h:499:16
           9: 0x496637 - JS::Realm::zone()
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Realm.h:674:38              - JS::Realm::isDebuggee() const
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSContext-inl.h:342:20              - js::DebugAPI::onNativeCall(JSContext*, JS::CallArgs const&, js::CallReason)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/debugger/DebugAPI-inl.h:137:7              - CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Interpreter.cpp:475:33              - js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Interpreter.cpp:581:12
          10: 0x4971b1 - js::gc::HeaderWord::get() const
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/gc/Cell.h:106:23              - js::gc::CellWithTenuredGCPointer<js::gc::Cell, js::Shape>::headerPtr() const
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/gc/Cell.h:799:60              - JSObject::shape() const
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSObject.h:93:37              - JSObject::getClass() const
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSObject.h:114:44              - bool JSObject::is<JSFunction>() const
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSFunction.h:915:10              - JSObject::isConstructor() const
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSObject-inl.h:581:7              - js::IsConstructor(JS::Value const&)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSObject-inl.h:555:39              - StackCheckIsConstructorCalleeNewTarget(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Interpreter.cpp:736:8              - js::ConstructFromStack(JSContext*, JS::CallArgs const&, js::CallReason)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/Interpreter.cpp:751:8
          11: 0x5298a4 - js::ContextChecks::fail(JS::Compartment*, JS::Compartment*, int)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSContext-inl.h:55:5              - js::ContextChecks::check(JS::Compartment*, int)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSContext-inl.h:71:7              - js::ContextChecks::check(JSObject*, int)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSContext-inl.h:84:7              - void JSContext::checkImpl<JS::Handle<JSObject*>, JS::Handle<JS::Value>, JS::HandleValueArray>(JS::Handle<JSObject*> const, JS::Handle<JS::Value>&, JS::HandleValueArray)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSContext-inl.h:207:33              - void JSContext::check<JS::Handle<JSObject*>, JS::Handle<JS::Value>, JS::HandleValueArray>(JS::Handle<JSObject*> const, JS::Handle<JS::Value>&, JS::HandleValueArray)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/JSContext-inl.h:214:5              - JS_CallFunctionValue(JSContext*, JS::Handle<JSObject*>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>)
                           at /home/runner/work/spidermonkey-wasi-embedding/spidermonkey-wasi-embedding/gecko-dev/js/src/vm/CallAndConstruct.cpp:47:7
          12: 0x463131 - call
                           at /Users/cataggar/ms/ComponentizeJS/embedding/embedding.cpp:247:3
          13: 0xaa6f11 - <unknown>!ts:typescript/[email protected]#create-program2
          14:  0x475 - <unknown>!<wasm function 16>
          15: 0xfe42a14 - wit-component:shim!indirect-ts:typescript/[email protected]
          16: 0xfc789ce - test_rs::bindings::ts::typescript::typescript::create_program2::hae64a03b2adc5ede
                           at /Users/cataggar/ms/StarlingMonkey15/test-rs/src/bindings.rs:755:21
          17: 0xfc7b0ea - test_rs::main::h33a273051fcbbb37
                           at /Users/cataggar/ms/StarlingMonkey15/test-rs/src/main.rs:14:19
          18: 0xfc7a2a4 - core::ops::function::FnOnce::call_once::h9b820a427be526b0
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
          19: 0xfc7964d - std::sys::backtrace::__rust_begin_short_backtrace::hb2497b17a7e50fbb
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:152:18
          20: 0xfc7780a - std::rt::lang_start::{{closure}}::h5595b1a03a130abc
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:162:18
          21: 0xfc7f369 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hda5cc35229b3e2d7
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:284:13              - std::panicking::try::do_call::h0757ac3fec725a99
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:557:40              - std::panicking::try::h812b834d48089f5c
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:521:19              - std::panic::catch_unwind::hbe21da14a7442526
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panic.rs:350:14              - std::rt::lang_start_internal::{{closure}}::h5f6564c4db031e37
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:141:48              - std::panicking::try::do_call::h09de3a5111bf0861
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:557:40              - std::panicking::try::h1d0b07860d5981d0
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:521:19              - std::panic::catch_unwind::haad2596de262ec59
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panic.rs:350:14              - std::rt::lang_start_internal::hdc680a054eeeacf1
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:141:20
          22: 0xfc77799 - std::rt::lang_start::h242dfa399eeb65ef
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:161:17
          23: 0xfc7b329 - test_rs-6fa4481e8149828b.wasm!__main_void
          24: 0xfc772cd - test_rs-6fa4481e8149828b.wasm!_start
          25: 0xfe3fed0 - wit-component:adapter:wasi_snapshot_preview1!wasi:cli/[email protected]#run
    2: wasm trap: wasm `unreachable` instruction executed
error: script "run" exited with code 134
typescript version: 5.6.3
get_executing_file_path()
System.getCurrentDirectory
get_current_directory()
read_file "abc.ts" length 61
get_directories "node_modules/@types" result: ["plist", "normalize-package-data", "ssri", "argparse", "yargs-parser", "aws-lambda", "mustache", "bun", "semver", "istanbul-lib-coverage", "json5", "prompts", "yargs", "estree", "node", "yauzl", "micromatch", "babel__code-frame", "braces", "ws", "json-schema"]
read_file "node_modules/@types/plist/package.json" length 842
read_file "node_modules/@types/normalize-package-data/package.json" length 843
read_file "node_modules/@types/ssri/package.json" length 1119
read_file "node_modules/@types/argparse/package.json" length 1312
read_file "node_modules/@types/yargs-parser/package.json" length 804
read_file "node_modules/@types/aws-lambda/package.json" length 6962
read_file "node_modules/@types/mustache/package.json" length 1463
read_file "node_modules/@types/bun/package.json" length 1598
read_file "node_modules/@types/semver/package.json" length 1562
read_file "node_modules/@types/istanbul-lib-coverage/package.json" length 846
read_file "node_modules/@types/json5/package.json" length 517
read_file "node_modules/@types/prompts/package.json" length 1777
read_file "node_modules/@types/yargs/package.json" length 2521
read_file "node_modules/@types/estree/package.json" length 801
read_file "node_modules/@types/node/package.json" length 6671
read_file "node_modules/@types/yauzl/package.json" length 815
read_file "node_modules/@types/micromatch/package.json" length 819
read_file "node_modules/@types/babel__code-frame/package.json" length 987
read_file "node_modules/@types/braces/package.json" length 1045
read_file "node_modules/@types/ws/package.json" length 2072
read_file "node_modules/@types/json-schema/package.json" length 1253
read_file "node_modules/@types/plist/package.json" length 842
real_path("node_modules/@types/plist/index.d.ts")
read_file "node_modules/@types/normalize-package-data/package.json" length 843
real_path("node_modules/@types/normalize-package-data/index.d.ts")
read_file "node_modules/@types/ssri/package.json" length 1119
real_path("node_modules/@types/ssri/index.d.ts")
read_file "node_modules/@types/argparse/package.json" length 1312
real_path("node_modules/@types/argparse/index.d.ts")
read_file "node_modules/@types/yargs-parser/package.json" length 804
real_path("node_modules/@types/yargs-parser/index.d.ts")
read_file "node_modules/@types/aws-lambda/package.json" length 6962
real_path("node_modules/@types/aws-lambda")
real_path("node_modules/@types/aws-lambda/index.d.ts")
read_file "node_modules/@types/mustache/package.json" length 1463
real_path("node_modules/@types/mustache/index.d.ts")
read_file "node_modules/@types/bun/package.json" length 1598
real_path("node_modules/@types/bun")
real_path("node_modules/@types/bun/index.d.ts")
read_file "node_modules/@types/semver/package.json" length 1562
real_path("node_modules/@types/semver/index.d.ts")
read_file "node_modules/@types/istanbul-lib-coverage/package.json" length 846
real_path("node_modules/@types/istanbul-lib-coverage/index.d.ts")
read_file "node_modules/@types/json5/package.json" length 517
real_path("node_modules/@types/json5/index.d.ts")
read_file "node_modules/@types/prompts/package.json" length 1777
real_path("node_modules/@types/prompts/index.d.ts")
read_file "node_modules/@types/yargs/package.json" length 2521
real_path("node_modules/@types/yargs/index.d.ts")
read_file "node_modules/@types/estree/package.json" length 801
real_path("node_modules/@types/estree/index.d.ts")
read_file "node_modules/@types/node/package.json" length 6671
real_path("node_modules/@types/node")
real_path("node_modules/@types/node/ts5.6/index.d.ts")
read_file "node_modules/@types/yauzl/package.json" length 815
real_path("node_modules/@types/yauzl/index.d.ts")
read_file "node_modules/@types/micromatch/package.json" length 819
real_path("node_modules/@types/micromatch/index.d.ts")
read_file "node_modules/@types/babel__code-frame/package.json" length 987
real_path("node_modules/@types/babel__code-frame/index.d.ts")
read_file "node_modules/@types/braces/package.json" length 1045
real_path("node_modules/@types/braces/index.d.ts")
read_file "node_modules/@types/ws/package.json" length 2072
real_path("node_modules/@types/ws")
real_path("node_modules/@types/ws/index.d.ts")
read_file "node_modules/@types/json-schema/package.json" length 1253
real_path("node_modules/@types/json-schema/index.d.ts")
read_file "node_modules/@types/plist/index.d.ts" length 666
real_path("node_modules/@types/node/ts5.6/index.d.ts")
read_file "node_modules/@types/node/ts5.6/index.d.ts" length 4062
read_file "node_modules/@types/node/compatibility/index.d.ts" length 533
read_file "node_modules/@types/node/compatibility/disposable.d.ts" length 473
read_file "node_modules/@types/node/compatibility/indexable.d.ts" length 1195
read_file "node_modules/@types/node/compatibility/iterators.d.ts" length 1303
read_file "node_modules/@types/node/ts5.6/globals.typedarray.d.ts" length 457
read_file "node_modules/@types/node/ts5.6/buffer.buffer.d.ts" length 18388
read_file "node_modules/@types/node/globals.d.ts" length 20793
read_file "node_modules/undici-types/package.json" length 1193
real_path("node_modules/undici-types/index.d.ts")
read_file "node_modules/undici-types/index.d.ts" length 3387
read_file "node_modules/undici-types/dispatcher.d.ts" length 14188
read_file "node_modules/buffer/package.json" length 2597
real_path("node_modules/buffer/index.d.ts")
read_file "node_modules/buffer/index.d.ts" length 8755
read_file "node_modules/undici-types/header.d.ts" length 133
read_file "node_modules/undici-types/readable.d.ts" length 1595
read_file "node_modules/undici-types/formdata.d.ts" length 4998
real_path("node_modules/@types/node/ts5.6/index.d.ts")
read_file "node_modules/undici-types/file.d.ts" length 1707
read_file "node_modules/undici-types/fetch.d.ts" length 5575
read_file "node_modules/undici-types/errors.d.ts" length 4280
read_file "node_modules/undici-types/client.d.ts" length 4964
read_file "node_modules/undici-types/connector.d.ts" length 1029
read_file "node_modules/undici-types/global-dispatcher.d.ts" length 276
read_file "node_modules/undici-types/global-origin.d.ts" length 175
read_file "node_modules/undici-types/pool.d.ts" length 1336
read_file "node_modules/undici-types/pool-stats.d.ts" length 669
read_file "node_modules/undici-types/handlers.d.ts" length 447
read_file "node_modules/undici-types/balanced-pool.d.ts" length 961
read_file "node_modules/undici-types/agent.d.ts" length 1065
read_file "node_modules/undici-types/mock-client.d.ts" length 1002
read_file "node_modules/undici-types/mock-agent.d.ts" length 2535
read_file "node_modules/undici-types/mock-interceptor.d.ts" length 3902
read_file "node_modules/undici-types/mock-pool.d.ts" length 974
read_file "node_modules/undici-types/mock-errors.d.ts" length 338
read_file "node_modules/undici-types/proxy-agent.d.ts" length 780
read_file "node_modules/undici-types/env-http-proxy-agent.d.ts" length 675
read_file "node_modules/undici-types/retry-handler.d.ts" length 2983
read_file "node_modules/undici-types/retry-agent.d.ts" length 232
read_file "node_modules/undici-types/api.d.ts" length 1455
read_file "node_modules/undici-types/interceptors.d.ts" length 743
read_file "node_modules/undici-types/util.d.ts" length 623
read_file "node_modules/undici-types/cookies.d.ts" length 635
read_file "node_modules/undici-types/eventsource.d.ts" length 1672
read_file "node_modules/undici-types/websocket.d.ts" length 3864
read_file "node_modules/undici-types/patch.d.ts" length 1678
read_file "node_modules/undici-types/filereader.d.ts" length 1453
read_file "node_modules/undici-types/diagnostics-channel.d.ts" length 1579
read_file "node_modules/undici-types/content-type.d.ts" length 561
read_file "node_modules/undici-types/cache.d.ts" length 1251
read_file "node_modules/@types/node/assert.d.ts" length 43844
read_file "node_modules/@types/node/assert/strict.d.ts" length 201
read_file "node_modules/@types/node/async_hooks.d.ts" length 23285
read_file "node_modules/@types/node/buffer.d.ts" length 87937
read_file "node_modules/@types/node/child_process.d.ts" length 69757
read_file "node_modules/@types/node/cluster.d.ts" length 28016
read_file "node_modules/@types/node/console.d.ts" length 21249
read_file "node_modules/@types/node/constants.d.ts" length 623
read_file "node_modules/@types/node/crypto.d.ts" length 188137
read_file "node_modules/@types/node/dgram.d.ts" length 27770
read_file "node_modules/@types/node/diagnostics_channel.d.ts" length 24043
read_file "node_modules/@types/node/dns.d.ts" length 35538
read_file "node_modules/@types/node/dns/promises.d.ts" length 20582
read_file "node_modules/@types/node/domain.d.ts" length 7812
read_file "node_modules/@types/node/dom-events.d.ts" length 5871
read_file "node_modules/@types/node/events.d.ts" length 43156
read_file "node_modules/@types/node/fs.d.ts" length 189719
read_file "node_modules/@types/node/fs/promises.d.ts" length 55317
read_file "node_modules/@types/node/http.d.ts" length 87176
read_file "node_modules/@types/node/http2.d.ts" length 125594
read_file "node_modules/@types/node/https.d.ts" length 24777
read_file "node_modules/@types/node/inspector.d.ts" length 197531
read_file "node_modules/@types/node/module.d.ts" length 13220
read_file "node_modules/@types/node/net.d.ts" length 46265
read_file "node_modules/@types/node/os.d.ts" length 18956
read_file "node_modules/@types/node/path.d.ts" length 8235
read_file "node_modules/@types/node/perf_hooks.d.ts" length 37469
read_file "node_modules/@types/node/process.d.ts" length 96695
real_path("node_modules/buffer/index.d.ts")
read_file "node_modules/punycode/package.json" length 1227
real_path("node_modules/punycode/punycode.js")
read_file "node_modules/string_decoder/package.json" length 823
real_path("node_modules/string_decoder/lib/string_decoder.js")
read_file "node_modules/@types/node/punycode.d.ts" length 5479
read_file "node_modules/@types/node/querystring.d.ts" length 7137
read_file "node_modules/@types/node/readline.d.ts" length 23439
read_file "node_modules/@types/node/readline/promises.d.ts" length 6121
read_file "node_modules/@types/node/repl.d.ts" length 19507
read_file "node_modules/@types/node/sea.d.ts" length 6204
read_file "node_modules/@types/node/sqlite.d.ts" length 11424
read_file "node_modules/@types/node/stream.d.ts" length 84465
read_file "node_modules/@types/node/stream/promises.d.ts" length 2971
read_file "node_modules/@types/node/stream/consumers.d.ts" length 727
read_file "node_modules/@types/node/stream/web.d.ts" length 29492
read_file "node_modules/@types/node/string_decoder.d.ts" length 2827
read_file "node_modules/@types/node/test.d.ts" length 86920
read_file "node_modules/@types/node/timers.d.ts" length 12272
read_file "node_modules/@types/node/timers/promises.d.ts" length 3513
read_file "node_modules/@types/node/tls.d.ts" length 57334
read_file "node_modules/@types/node/trace_events.d.ts" length 8926
read_file "node_modules/@types/node/tty.d.ts" length 10053
read_file "node_modules/@types/node/url.d.ts" length 42696
read_file "node_modules/@types/node/util.d.ts" length 88766
read_file "node_modules/@types/node/v8.d.ts" length 34767
read_file "node_modules/@types/node/vm.d.ts" length 40176
read_file "node_modules/@types/node/wasi.d.ts" length 7935
read_file "node_modules/@types/node/worker_threads.d.ts" length 35322
read_file "node_modules/@types/node/zlib.d.ts" length 20640
read_file "node_modules/typescript/lib/lib.es2020.d.ts" length 1201
read_file "node_modules/typescript/lib/lib.es2019.d.ts" length 1071
read_file "node_modules/typescript/lib/lib.es2018.d.ts" length 1088
read_file "node_modules/typescript/lib/lib.es2017.d.ts" length 1119
read_file "node_modules/typescript/lib/lib.es2016.d.ts" length 965
read_file "node_modules/typescript/lib/lib.es2015.d.ts" length 1241
read_file "node_modules/typescript/lib/lib.es5.d.ts" length 215038
read_file "node_modules/typescript/lib/lib.decorators.d.ts" length 13194
read_file "node_modules/typescript/lib/lib.decorators.legacy.d.ts" length 1326
read_file "node_modules/typescript/lib/lib.es2015.core.d.ts" length 22524
read_file "node_modules/typescript/lib/lib.es2015.collection.d.ts" length 5229
read_file "node_modules/typescript/lib/lib.es2015.iterable.d.ts" length 15914
read_file "node_modules/typescript/lib/lib.es2015.symbol.d.ts" length 1649
read_file "node_modules/typescript/lib/lib.es2015.generator.d.ts" length 2557
read_file "node_modules/typescript/lib/lib.es2015.promise.d.ts" length 3200
read_file "node_modules/typescript/lib/lib.es2015.proxy.d.ts" length 5251
read_file "node_modules/typescript/lib/lib.es2015.reflect.d.ts" length 6493
read_file "node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts" length 10623
read_file "node_modules/typescript/lib/lib.es2016.array.include.d.ts" length 4862
read_file "node_modules/typescript/lib/lib.es2016.intl.d.ts" length 1490
read_file "node_modules/typescript/lib/lib.es2017.object.d.ts" length 2473
read_file "node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts" length 6227
read_file "node_modules/typescript/lib/lib.es2017.string.d.ts" length 2378
read_file "node_modules/typescript/lib/lib.es2017.intl.d.ts" length 1449
read_file "node_modules/typescript/lib/lib.es2017.typedarrays.d.ts" length 1425
read_file "node_modules/typescript/lib/lib.es2017.date.d.ts" length 1916
read_file "node_modules/typescript/lib/lib.es2018.asynciterable.d.ts" length 2257
read_file "node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts" length 2692
read_file "node_modules/typescript/lib/lib.es2018.promise.d.ts" length 1353
read_file "node_modules/typescript/lib/lib.es2018.regexp.d.ts" length 1232
read_file "node_modules/typescript/lib/lib.es2018.intl.d.ts" length 3021
read_file "node_modules/typescript/lib/lib.es2019.array.d.ts" length 3163
read_file "node_modules/typescript/lib/lib.es2019.object.d.ts" length 1473
read_file "node_modules/typescript/lib/lib.es2019.string.d.ts" length 1528
read_file "node_modules/typescript/lib/lib.es2019.symbol.d.ts" length 1006
read_file "node_modules/typescript/lib/lib.es2019.intl.d.ts" length 958
read_file "node_modules/typescript/lib/lib.es2020.bigint.d.ts" length 35419
read_file "node_modules/typescript/lib/lib.es2020.intl.d.ts" length 22654
read_file "node_modules/typescript/lib/lib.es2020.date.d.ts" length 2956
read_file "node_modules/typescript/lib/lib.es2020.number.d.ts" length 1587
read_file "node_modules/typescript/lib/lib.es2020.promise.d.ts" length 1803
read_file "node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts" length 4749
read_file "node_modules/typescript/lib/lib.es2020.string.d.ts" length 2480
read_file "node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts" length 1606
read_file "node_modules/xmlbuilder/package.json" length 1205
real_path("node_modules/xmlbuilder/typings/index.d.ts")
read_file "node_modules/xmlbuilder/typings/index.d.ts" length 53725
read_file "node_modules/@types/normalize-package-data/index.d.ts" length 1583
read_file "node_modules/@types/ssri/index.d.ts" length 5400
real_path("node_modules/@types/node/ts5.6/index.d.ts")
read_file "node_modules/@types/argparse/index.d.ts" length 4187
read_file "node_modules/@types/yargs-parser/index.d.ts" length 6215
read_file "node_modules/@types/aws-lambda/index.d.ts" length 2397
read_file "node_modules/@types/aws-lambda/common/api-gateway.d.ts" length 3039
read_file "node_modules/@types/aws-lambda/common/cloudfront.d.ts" length 10095

In '.' script 'run' failed with exit code 134
@cataggar
Copy link
Contributor Author

cataggar commented Dec 31, 2024

Steps to reproduce:

git clone [email protected]:cataggar/StarlingMonkey15.git --no-checkout
cd StarlingMonkey15
git checkout ComponentizeJS176
bun install
bun run build.ts

This is using local copies of jco and ComponentizeJS. It takes about 40 seconds with the typescript compiler reading all those files.

@guybedford
Copy link
Collaborator

ComponentizeJS doesn't support debug builds at all - this is due to the nature of the splicing code in https://github.com/bytecodealliance/ComponentizeJS/blob/main/crates/spidermonkey-embedding-splicer/src/splice.rs. Supporting debug builds would be a very worthwhile feature, but involves changing the code injections to handle JS operations at https://github.com/bytecodealliance/ComponentizeJS/blob/main/embedding/embedding.cpp#L89. The error you are seeing is most likely due to this code being incorrect.

@cataggar
Copy link
Contributor Author

cataggar commented Dec 31, 2024

Using the release build of ComponentizeJS, we are back to needing debug traces:

The wasm backtrace is:

$ WASMTIME_BACKTRACE_DETAILS=1 wasmtime run --dir .::/ test-rs/target/test2.wasm a b c
Error: failed to run main module `test-rs/target/test2.wasm`

Caused by:
    0: failed to invoke `run` function
    1: error while executing at wasm backtrace:
           0: 0x7b6b0d - <unknown>!<wasm function 10032>
           1: 0x455cce - <unknown>!<wasm function 5027>
           2: 0x483c29 - <unknown>!<wasm function 5292>
           3: 0x48485c - <unknown>!<wasm function 5295>
           4: 0x48507a - <unknown>!<wasm function 5298>
           5: 0x589802 - <unknown>!<wasm function 7105>
           6: 0x48881c - <unknown>!<wasm function 5326>
           7: 0x47b4d6 - <unknown>!<wasm function 5291>
           8: 0x47542c - <unknown>!<wasm function 5289>
           9: 0x483aef - <unknown>!<wasm function 5292>
          10: 0x48485c - <unknown>!<wasm function 5295>
          11: 0x504f00 - <unknown>!<wasm function 6286>
          12: 0x454532 - <unknown>!<wasm function 5019>
          13: 0x9cdf21 - <unknown>!ts:typescript/[email protected]#create-program
          14:  0x540 - <unknown>!<wasm function 16>
          15: 0x598f39a - wit-component:shim!indirect-ts:typescript/[email protected]
          16: 0x57c2530 - test_rs::bindings::ts::typescript::typescript::create_program::h8b07e3fcab005ae5
                           at /Users/cataggar/ms/StarlingMonkey15/test-rs/src/bindings.rs:699:21
          17: 0x57c5230 - test_rs::main::h33a273051fcbbb37
                           at /Users/cataggar/ms/StarlingMonkey15/test-rs/src/main.rs:18:19
          18: 0x57c432c - core::ops::function::FnOnce::call_once::h9b820a427be526b0
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
          19: 0x57c36d5 - std::sys::backtrace::__rust_begin_short_backtrace::hb2497b17a7e50fbb
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:152:18
          20: 0x57c0f67 - std::rt::lang_start::{{closure}}::h5595b1a03a130abc
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:162:18
          21: 0x57c96fc - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hda5cc35229b3e2d7
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:284:13              - std::panicking::try::do_call::h0757ac3fec725a99
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:557:40              - std::panicking::try::h812b834d48089f5c
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:521:19              - std::panic::catch_unwind::hbe21da14a7442526
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panic.rs:350:14              - std::rt::lang_start_internal::{{closure}}::h5f6564c4db031e37
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:141:48              - std::panicking::try::do_call::h09de3a5111bf0861
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:557:40              - std::panicking::try::h1d0b07860d5981d0
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:521:19              - std::panic::catch_unwind::haad2596de262ec59
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panic.rs:350:14              - std::rt::lang_start_internal::hdc680a054eeeacf1
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:141:20
          22: 0x57c0ef6 - std::rt::lang_start::h242dfa399eeb65ef
                           at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:161:17
          23: 0x57c56bc - test_rs-6fa4481e8149828b.wasm!__main_void
          24: 0x57c0a2a - test_rs-6fa4481e8149828b.wasm!_start
          25: 0x598c849 - wit-component:adapter:wasi_snapshot_preview1!wasi:cli/[email protected]#run
    2: wasm trap: wasm `unreachable` instruction executed
error: script "run" exited with code 134

cataggar pushed a commit to cataggar/StarlingMonkey15 that referenced this issue Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants