Skip to content

WASI target: thread::sleep() is panicing: unexpected result of poll_oneoff #65607

Closed
@dunnock

Description

@dunnock

Following code seems correct though will always panic when compiled to wasm32-wasi:

fn main() { std::thread::sleep(std::time::Duration::new(0,5)); }

compiled with nightly rust 1.40:
>cargo +nightly build --target wasm32-wasi

It fails at least in wasmtime and wasmer-js VMs (example https://github.com/dunnock/wabench/tree/master/poll_oneoff_test):

> wasmtime target/wasm32-wasi/debug/poll_oneoff_test.wasm

thread 'main' panicked at 'thread::sleep(): unexpected result of poll_oneoff', src/libstd/sys/wasi/thread.rs:61:18
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace.
error: failed to process main module target/wasm32-wasi/debug/poll_oneoff_test.wasm
    caused by: Instantiation error: Trap occurred while invoking start function: wasm trap: unreachable, source location: @8f01

rustup show:

active toolchain
nightly-x86_64-apple-darwin (default)
rustc 1.40.0-nightly (0e8a4b441 2019-10-16)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions