Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write failed error running in wasmtime #511

Closed
leonardas103 opened this issue Nov 8, 2019 · 4 comments
Closed

write failed error running in wasmtime #511

leonardas103 opened this issue Nov 8, 2019 · 4 comments
Labels
wasi:impl Issues pertaining to WASI implementation in Wasmtime

Comments

@leonardas103
Copy link

This is somewhat related to: Issue

In wasmtime writing to file I get the following error:

thread 'main' panicked at 'write failed: Os { code: 76, kind: Other, message: "Capabilities insufficient" }', src/libcore/result.rs:1084:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: failed to process main module `demo.wasm`
    caused by: Instantiation error: Trap occurred while invoking start function: wasm trap: unreachable, source location: @3adc6

I do include the file directory properly: wasmtime --dir=. demo.wasm '{"a":"txt","b": 1}'
While with wasmer I do not get this error.
Note: See the code linked in the wasmer issue. Also, this error is the same without the append flag.

@kubkon
Copy link
Member

kubkon commented Nov 8, 2019

Hey @leonardas103! Thanks for submitting the issue. It looks to me like perhaps an issue with our WASI implementation. Could you do me a favour and re-run your binary with logs for wasi-common enabled like so:

RUST_LOG=wasi_common=trace wasmtime -d --dir=. demo.wasm '{"a": "txt", "b": 1}'

This will effectively enable trace level logs for our WASI syscalls implementation.

@alexcrichton alexcrichton added the wasi:impl Issues pertaining to WASI implementation in Wasmtime label Feb 20, 2020
@bjorn3
Copy link
Contributor

bjorn3 commented Mar 20, 2021

I think this should be closed. It has been a year without response and in the mean time the wasi implementation has been completely rewritten.

@peterhuene
Copy link
Member

Agreed. @leonardas103 if you're able to reproduce this with a recent Wasmtime build, please let us know.

@leonardas103
Copy link
Author

Now when I run my old wasm file with wasmtime (0.25.0) I get:

Error: failed to run main module `demo_old.wasm`

Caused by:
    0: failed to instantiate "demo_old.wasm"
    1: command export '__rustc_debug_gdb_scripts_section__' is not a function

I recompiled the code with the latest rust (1.50.0) and the program works as intended, however in the trace there was an error:

 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > wiggle abi; module="wasi_snapshot_preview1" function="environ_sizes_get"
 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > result=Ok((0, 0)) 
 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > wiggle abi; module="wasi_snapshot_preview1" function="fd_prestat_get"
 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > fd=Fd(3) 
 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > result=Ok(Dir(PrestatDir { pr_name_len: 1 })) 
 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > wiggle abi; module="wasi_snapshot_preview1" function="fd_prestat_dir_name"
 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > fd=Fd(3) path=*guest 0x110010 path_len=1 
 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > result=Ok(()) 
 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > wiggle abi; module="wasi_snapshot_preview1" function="fd_prestat_get"
 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > fd=Fd(4) 
 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > result=Err(Badf: Bad file descriptor) 
 DEBUG wasi_common::snapshots::preview_1                         > **Error: Badf: Bad file descriptor** 
 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > wiggle abi; module="wasi_snapshot_preview1" function="fd_write"
 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > fd=Fd(1) iovs=*guest 0xffcb0/1 
 TRACE wasi_common::snapshots::preview_1::wasi_snapshot_preview1 > result=Ok(43) 

But this is probably nothing. The program writes to file as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasi:impl Issues pertaining to WASI implementation in Wasmtime
Projects
None yet
Development

No branches or pull requests

5 participants