second-state / wasmedge-quickjs

A high-performance, secure, extensible, and OCI-complaint JavaScript runtime for WasmEdge.
Apache License 2.0
496 stars 61 forks source link

Javascript setTimeout not working #61

Open shebbys opened 2 years ago

shebbys commented 2 years ago

I'm unable to get setTimeout to work in the example hello.js and react18_ssr, on a mac m1.

The function exists however it never actually times out - it just hangs indefinitely.

L-jasmine commented 2 years ago

@hydai I think there are some bugs in Mac's poll_oneoff()

hydai commented 2 years ago

Hi @shebbys Could you provide a minimum code snippet for reproducing this issue?

L-jasmine commented 2 years ago

I will provide a minimum code

shebbys commented 2 years ago

This is enough to reproduce it

(base) example_js % cat timeout.js import as os from 'os'; import as std from 'std'; let timer = setTimeout( ()=>{ print('yep'); }, 2000 ) (base) example_js % wasmedge --dir .:. ../target/wasm32-wasi/release/wasmedge_quickjs.wasm timeout.js

Tails commented 2 years ago

Can reproduce the hanging on MacOS Catalina.