moonrepo / proto

A pluggable multi-language version manager.
https://moonrepo.dev/proto
MIT License
690 stars 34 forks source link

node fails to install #208

Closed nmccready closed 1 year ago

nmccready commented 1 year ago

What version?

0.18.1

Which command?

proto install node 14

What happened?

I also tried node 18, bun and go work.

$ WASMTIME_BACKTRACE_DETAILS=1 proto install node 14
Error: plugin::failed

  × Call failed
  │
  │ Caused by:
  │     0: error while executing at wasm backtrace:
  │            0:  0x691 - <unknown>!<wasm function 7>
  │            1: 0x1edcb - <unknown>!<wasm function 195>
  │            2: 0x4512d - <unknown>!<wasm function 435>
  │     1: memory fault at wasm address 0xfffffff4 in linear memory of size 0x120000
  │     2: wasm trap: out of bounds memory access

Against npm-latest-830386a9790cc971b3e0e7d361083b46804c0a2c66cecb310363e8e2e5e19d8b.wasm

Any logs?

No response

Operating system?

MacOS

Architecture?

x64

nmccready commented 1 year ago

I can grab logs, but I am unsure where they are.

milesj commented 1 year ago

This looks like it's hitting some kind of wasm memory bounds. Let me see if I can bump it.

milesj commented 1 year ago

Can you try 0.18.2?

nmccready commented 1 year ago

Still blowing up

nmccready commented 1 year ago
$ proto --log=trace install node 14
[DEBUG 2023-09-19 11:07:50] proto  Running proto v0.18.2
[TRACE 11:07:50] starbase::app  Running startup phase with 1 systems
[TRACE 11:07:50] starbase::app  Running analyze phase with 1 systems
[TRACE 11:07:50] starbase::app  Running execute phase with 2 systems
[DEBUG 11:07:50] proto_core::tool_loader:install  Traversing upwards to find a configured plugin  tool="node"
[DEBUG 11:07:50] proto_core::tools_config:install:load  Loading .prototools  file="/Users/SOME_USER/SOME_PATH
[TRACE 11:07:50] starbase_utils::fs:install:load  Opening file  file="/Users/SOME_USER/SOME_PATH
[TRACE 11:07:50] starbase_utils::fs_lock:install:load  Locking file  file="/Users/SOME_USER/SOME_PATH
[TRACE 11:07:50] starbase_utils::fs_lock:install:load  Unlocking file  file="/Users/SOME_USER/SOME_PATH
[DEBUG 11:07:50] proto_core::tools_config:install:load  Loading .prototools  file="/Users/SOME_USER/.prototools"
[TRACE 11:07:50] starbase_utils::fs:install:load  Opening file  file="/Users/SOME_USER/.prototools"
[TRACE 11:07:50] starbase_utils::fs_lock:install:load  Locking file  file="/Users/SOME_USER/.prototools"
[TRACE 11:07:50] starbase_utils::fs_lock:install:load  Unlocking file  file="/Users/SOME_USER/.prototools"
[TRACE 11:07:50] warpgate::loader:install  Creating plugin loader  cache_dir="/Users/SOME_USER/.proto/plugins"
[TRACE 11:07:50] warpgate::loader:install  Loading plugin node  plugin="node" locator="source:https://github.com/moonrepo/node-plugin/releases/latest/download/node_plugin.wasm"
[TRACE 11:07:50] starbase_utils::fs:install  Reading file metadata  file="/Users/SOME_USER/.proto/plugins/node-latest-a52b08d6beecba14226de2046940c019fdbadd910c87a138d8303d1d91f30bb9.wasm"
[TRACE 11:07:50] warpgate::loader:install  Plugin already downloaded and cached  plugin="node" path="/Users/SOME_USER/.proto/plugins/node-latest-a52b08d6beecba14226de2046940c019fdbadd910c87a138d8303d1d91f30bb9.wasm"
[DEBUG 11:07:50] proto_core::tool_loader:install  Loading WASM plugin  source="/Users/SOME_USER/.proto/plugins/node-latest-a52b08d6beecba14226de2046940c019fdbadd910c87a138d8303d1d91f30bb9.wasm"
[DEBUG 11:07:50] proto_core::tool:install  Creating tool node and instantiating plugin
[DEBUG 11:07:50] proto_core::tool_manifest:install:load  Loading manifest.json  file="/Users/SOME_USER/.proto/tools/node/manifest.json"
[DEBUG 11:07:51] proto_core::tool:install  Created tool node and its WASM runtime
[TRACE 11:07:51] warpgate::plugin:install  Calling plugin function register_tool  plugin="node" input={"id":"node"}
[TRACE 11:07:51] warpgate::plugin:install  Called plugin function register_tool  plugin="node" output={"env_vars":["NODE_OPTIONS","NODE_PATH"],"inventory":{"disable_progress_bars":false},"name":"Node.js","plugin_version":"0.3.0","type_of":"Language"}
[DEBUG 11:07:51] proto_core::tool:install  Resolving a semantic version or alias  tool="node" initial_version="~14"
[DEBUG 11:07:51] proto_core::tool:install  Loading available versions  tool="node"
[TRACE 11:07:51] warpgate::plugin:install  Calling plugin function load_versions  plugin="node" input={"context":{"env_vars":{"NODE_PATH":"/Users/SOME_USER/.nvm/versions/node/v14.21.3/bin"},"tool_dir":{"path":"/home/.proto/tools/node/latest","virtual_prefix":"/home","real_prefix":"/Users/SOME_USER"},"version":"latest"},"initial":"~14"}
[TRACE 11:07:51] starbase::app  Running shutdown phase with 1 systems
Error: plugin::failed

  × Call failed
  │
  │ Caused by:
  │     0: error while executing at wasm backtrace:
  │            0:  0x649 - <unknown>!<wasm function 7>
  │            1: 0x1edcb - <unknown>!<wasm function 195>
  │            2: 0x4512d - <unknown>!<wasm function 435>
  │        note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable
  │ may show more debugging information
  │     1: memory fault at wasm address 0xfffffff4 in linear memory of size
  │ 0x120000
  │     2: wasm trap: out of bounds memory access
milesj commented 1 year ago

This is a tough once since I can't reproduce it.

Will look into again.

nmccready commented 1 year ago

Let me know if there is more debug output I can do. Its got to be another proxy issue as this does not happen on my personal machine.

milesj commented 1 year ago

If I think of something I'll let you know. Debugging WASM is... not trivial.

bhelx commented 1 year ago

I have a PR #212 which i think should fix the last of these bugs. It's our fault for having bugs in our kernel. The issue is inside Extism itself, not your Wasm plug-ins. This should become a much more rare event when we hit 1.0 in a few months.

nmccready commented 1 year ago

Thank you @bhelx

bhelx commented 1 year ago

no problem! we'll be here to fix any bugs that come up.

milesj commented 1 year ago

Can you try 0.18.3?