Closed burakakca closed 2 years ago
Thanks for your feedback. @juntao and @tpmccallum could you take a look? Maybe because we renamed the SSVM to WasmEdge-core?
Hi, Thanks, checking on this now. Tim
Hi,
It seems that this is only an issue with the AOT compiled binary.
For example, if I compile this hello world example [1] using rustwasmc build
and then run the .wasm
using the following node CLI (for simplicity and demonstration purposes) it works find.
// Create ssvm instance
const ssvm = require("wasmedge-extensions");
// Load Wasm
const path = "/home/tpmccallum/hello_lib_bg.wasm";
vm = new ssvm.VM(path, { args:process.argv, env:process.env, preopens:{"/": "/tmp"} });
// Run function
var return_value = vm.RunString("say", "asdf");
console.log("Return value: " + return_value);
The following output shows success
$ node tester.js
Return value: hello asdf
Alternatively, if I use AOT compile process and run the .so
instead of the .wasm
then an issue occurs.
// Create ssvm instance
const ssvm = require("wasmedge-extensions");
// Load Wasm
const path = "/home/tpmccallum/hello_lib_bg.wasm";
vm = new ssvm.VM(path, { args:process.argv, env:process.env, preopens:{"/": "/tmp"} });
// AOT
vm.Compile(aot_path);
var vm_aot = new ssvm.VM(aot_path, { EnableAOT:true, rgs:process.argv, env:process.env, preopens:{"/": "/tmp"} });
// Run function
var return_value = vm_aot.RunString("say", "asdf");
console.log("Return value: " + return_value);
The following output shows the error
[2021-10-20 09:59:08.164] [error] execution failed: out of bounds memory access, Code: 0x88
[2021-10-20 09:59:08.164] [error] When executing function name: "__wbindgen_malloc"
[2021-10-20 09:59:08.164] [error] execution failed: function signature mismatch, Code: 0x83
[2021-10-20 09:59:08.164] [error] Mismatched function type. Expected: params{i32 , i32 , i32} returns{} , Got: params{i32} returns{}
[2021-10-20 09:59:08.164] [error] When executing function name: "say"
/media/nvme/node_rpc/wasm-joey/src/testing_using_node/tester.js:25
var return_value = vm_aot.RunString("say", "asdf");
^
Error: out of bounds memory access
at Object.<anonymous> (/media/nvme/node_rpc/wasm-joey/src/testing_using_node/tester.js:25:27)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47 {
code: 'Error'
}
[1] https://github.com/second-state/wasm-learning/tree/master/faas/hello
I see there was just an update regarding memory so I am just updating wasmedge-extensions
to lastest 0.8.2
and will try this again.
Hi @alabulei1 & @burakakca I would like to update to all the latest code and then share the outcome. There is an issue [1] in relation to wasmedge-extensions installer which when fixed will allow us to use the latest code. I will get back to you asap. Thanks [1] https://github.com/second-state/wasmedge-extensions/issues/3
Hi @juntao @alabulei1 and @burakakca
This should now be resolved.
@burakakca please install the latest wasmedge-extensions
as per this documentation and try again.
Here you can see a new hello
example (taken from this example) which I have uploaded to the Function As A Service (FaaS) which runs the same software. You can try calling it via Curl command in your Linux/Mac Command Line Interface (CLI)
curl --location --request POST 'https://rpc.ssvm.secondstate.io:8081/api/run/452/say' \
--header 'Content-Type: text/plain' \
--data-raw 'Tim'
Returns
hello Tim
Yes, works well. If i get similar new error, can i open this issue
Hi @burakakca Great to hear it is now working as intended. Yes, sure thing. Please share any new errors so that we can help out. Thanks for sharing.
I run server and upload this hello wasm example then i run on postman below code
Response error;
Console error;