wasm-nginx-module icon indicating copy to clipboard operation
wasm-nginx-module copied to clipboard

APISIX load wasm plugin report error in macosx platform?

Open jthann opened this issue 3 years ago • 1 comments
trafficstars

OS Platform Info:

Darwin 20.4.0 x86_64

Build Process:

1、Using APISIX build tools [email protected]:api7/apisix-build-tools.git tag:apisix/2.13.2 Runnging build-apisix-base.sh to build openresty and the result is successful. 2、Building APISIX [email protected]:apache/apisix.git tag: 2.13.2 Running make deps to build APISIX and the result is successful. 3、Compile wasm plugin: tinygo build -o ./fault-injection/main.go.wasm -scheduler=none -target=wasi ./fault-injection/main.go The main.go.wasm absolute path is /Users/John/fault-injection/main.go.wasm 4、Modify APISXIX config.yaml

wasm:
  plugins:
    - name: wasm-fault-injection
      priority: 7999
      file: /Users/John/fault-injection/main.go.wasm
      http_request_phase: access

5、Start APISIX sudo ./bin/apisix start

The ./logs/error.log as following

2022/07/11 16:59:57 [info] 27964#31196182: loaded wasm plugin
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port', crates/runtime/src/traphandlers/macos.rs:425:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2022/07/11 16:59:57 [error] 27964#31196182: failed to call function: assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port�
2022/07/11 16:59:57 [info] 27964#31196182: unloaded wasm plugin
2022/07/11 16:59:57 [error] 27964#31196182: *13 [lua] plugin.lua:110: load_plugin(): failed to load plugin [wasm-fault-injection] err: failed to load wasm plugin, context: init_worker_by_lua*
2022/07/11 16:59:57 [info] 27955#31196172: loaded wasm plugin
2022/07/11 16:59:57 [info] 27953#31196170: loaded wasm plugin
2022/07/11 16:59:57 [info] 27952#31196169: loaded wasm plugin
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port', crates/runtime/src/traphandlers/macos.rs:425:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2022/07/11 16:59:57 [info] 27961#31196179: loaded wasm plugin
2022/07/11 16:59:57 [error] 27952#31196169: failed to call function: assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port�
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port', crates/runtime/src/traphandlers/macos.rs:425:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2022/07/11 16:59:57 [error] 27961#31196179: failed to call function: assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port�
2022/07/11 16:59:57 [info] 27952#31196169: unloaded wasm plugin
2022/07/11 16:59:57 [error] 27952#31196169: *2 [lua] plugin.lua:110: load_plugin(): failed to load plugin [wasm-fault-injection] err: failed to load wasm plugin, context: init_worker_by_lua*
2022/07/11 16:59:57 [info] 27959#31196177: loaded wasm plugin
2022/07/11 16:59:57 [info] 27950#31196167: loaded wasm plugin
2022/07/11 16:59:57 [info] 27957#31196175: loaded wasm plugin
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port', crates/runtime/src/traphandlers/macos.rs:425:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2022/07/11 16:59:57 [error] 27950#31196167: failed to call function: assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port�
2022/07/11 16:59:57 [info] 27961#31196179: unloaded wasm plugin
2022/07/11 16:59:57 [error] 27961#31196179: *12 [lua] plugin.lua:110: load_plugin(): failed to load plugin [wasm-fault-injection] err: failed to load wasm plugin, context: init_worker_by_lua*
2022/07/11 16:59:57 [info] 27956#31196173: loaded wasm plugin
2022/07/11 16:59:57 [info] 27950#31196167: unloaded wasm plugin
2022/07/11 16:59:57 [error] 27950#31196167: *1 [lua] plugin.lua:110: load_plugin(): failed to load plugin [wasm-fault-injection] err: failed to load wasm plugin, context: init_worker_by_lua*
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port', crates/runtime/src/traphandlers/macos.rs:425:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2022/07/11 16:59:57 [error] 27956#31196173: failed to call function: assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port�
2022/07/11 16:59:57 [info] 27960#31196178: loaded wasm plugin
2022/07/11 16:59:57 [info] 27956#31196173: unloaded wasm plugin
2022/07/11 16:59:57 [error] 27956#31196173: *7 [lua] plugin.lua:110: load_plugin(): failed to load plugin [wasm-fault-injection] err: failed to load wasm plugin, context: init_worker_by_lua*
2022/07/11 16:59:57 [info] 27958#31196176: loaded wasm plugin
2022/07/11 16:59:57 [info] 27951#31196168: loaded wasm plugin
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port', crates/runtime/src/traphandlers/macos.rs:425:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2022/07/11 16:59:57 [error] 27951#31196168: failed to call function: assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port�
2022/07/11 16:59:57 [info] 27951#31196168: unloaded wasm plugin
2022/07/11 16:59:57 [error] 27951#31196168: *3 [lua] plugin.lua:110: load_plugin(): failed to load plugin [wasm-fault-injection] err: failed to load wasm plugin, context: init_worker_by_lua*
2022/07/11 16:59:57 [info] 27954#31196171: loaded wasm plugin
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port', crates/runtime/src/traphandlers/macos.rs:425:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2022/07/11 16:59:57 [error] 27954#31196171: failed to call function: assertion failed: `(left == right)`
  left: `268435466`,
 right: `0`: failed to set thread exception port�
2022/07/11 16:59:57 [info] 27954#31196171: unloaded wasm plugin
2022/07/11 16:59:57 [error] 27954#31196171: *5 [lua] plugin.lua:110: load_plugin(): failed to load plugin [wasm-fault-injection] err: failed to load wasm plugin, context: init_worker_by_lua*

jthann avatar Jul 11 '22 09:07 jthann

Look like it crashed into the rust crates which wasmtime depends on. Can you reproduce it in Linux (I don't have Mac to test it)?

spacewander avatar Jul 12 '22 06:07 spacewander