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

FreeBSD: wasmer hangs after running WASM file #3373

Closed
MalloryA opened this issue Nov 24, 2022 · 1 comment · Fixed by #3439
Closed

FreeBSD: wasmer hangs after running WASM file #3373

MalloryA opened this issue Nov 24, 2022 · 1 comment · Fixed by #3439
Labels
bug Something isn't working priority-low Low priority issue

Comments

@MalloryA
Copy link
Contributor

wasmer executes WASM files correctly, but after execution it hangs for around a minute before exiting.

% uname -a
FreeBSD athena 13.1-RELEASE-p3 FreeBSD 13.1-RELEASE-p3 GENERIC amd64
% echo "`./target/release/wasmer -V` | `rustc -V` | `uname -m`" 
wasmer 3.0.1 | rustc 1.63.0 (4b91a6ea7 2022-08-08) | amd64
% git show --oneline
a7defaf11a (HEAD -> master, origin/staging, origin/master, origin/HEAD) Merge #3365

Steps to reproduce

(gmake is GNU Make from package gmake, rust is installed via rustup and not from the FreeBSD rust package)

% gmake build-wasmer
% fetch https://registry-cdn.wapm.io/contents/syrusakbary/cowsay/0.2.0/target/wasm32-wasi/release/cowsay.wasm
% time ./target/release/wasmer cowsay.wasm -- hello world          

Expected behavior

The cow says "hello world" and the program immediately exits. It should take a fraction of a second (and it does when I run the same command on macOS).

Actual behavior

The cow says "hello world" within a second, then the process hangs for 55 seconds. The fact that time reports 100% cpu is unusual too.

% time ./target/release/wasmer cowsay.wasm -- hello world          
 _____________
< hello world >
 -------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
               ||----w |
                ||     ||
./target/release/wasmer cowsay.wasm -- hello world  55.54s user 0.02s system 100% cpu 55.557 total

Additional context

@MalloryA MalloryA added the bug Something isn't working label Nov 24, 2022
@Michael-F-Bryan
Copy link
Contributor

Thanks for reporting this @MalloryA. It might be something to do with our WasiPipe implementation reading stdout/stdin in a busy loop or pipes not being closed properly.

We're happy to review pull requests if someone finds a solution, but we don't currently have bandwidth to actively support BSD.

@Michael-F-Bryan Michael-F-Bryan added the priority-low Low priority issue label Nov 29, 2022
MalloryA added a commit to MalloryA/wasmer that referenced this issue Dec 20, 2022
This change prevents a long hang when a program exits.

FreeBSD's `__deregister_frame` and `__register_frame` implementation is
ported from GCC, which is why we're using the same frame registration
code for FreeBSD and GNU/Linux.

Link: https://github.com/freebsd/freebsd-src/blob/release/13.1.0/contrib/llvm-project/libunwind/src/UnwindLevel1-gcc-ext.c#L241-L299
Fixes: wasmerio#3373
MalloryA added a commit to MalloryA/wasmer that referenced this issue Dec 20, 2022
This change prevents a long hang when a program exits.

FreeBSD's `__deregister_frame` and `__register_frame` implementations
are ported from GCC, which is why we should be using the same frame
registration code for FreeBSD and GNU/Linux.

Link: https://github.com/freebsd/freebsd-src/blob/release/13.1.0/contrib/llvm-project/libunwind/src/UnwindLevel1-gcc-ext.c#L241-L299
Fixes: wasmerio#3373
MalloryA added a commit to MalloryA/wasmer that referenced this issue Dec 20, 2022
This change prevents a long hang when a program exits.

FreeBSD's `__deregister_frame` and `__register_frame` implementations
are ported from GCC, which is why we should be using the same frame
registration code for FreeBSD and GNU/Linux.

Link: https://github.com/freebsd/freebsd-src/blob/release/13.1.0/contrib/llvm-project/libunwind/src/UnwindLevel1-gcc-ext.c#L241-L299
Fixes: wasmerio#3373
MalloryA added a commit to MalloryA/wasmer that referenced this issue Dec 20, 2022
This change prevents a long hang when a program exits.

FreeBSD's `__deregister_frame` and `__register_frame` implementations
are ported from GCC, which is why we should be using the same frame
registration code for FreeBSD and GNU/Linux.

Link: https://github.com/freebsd/freebsd-src/blob/release/13.1.0/contrib/llvm-project/libunwind/src/UnwindLevel1-gcc-ext.c#L241-L299
Fixes: wasmerio#3373
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-low Low priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants