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

pooling allocator should take virtual address space into account (on aarch64 and riscv64) #8607

Closed
matsbror opened this issue May 13, 2024 · 3 comments · Fixed by #8610
Closed
Labels
bug Incorrect behavior in the current implementation that needs fixing

Comments

@matsbror
Copy link

Thanks for filing a bug report! Please fill out the TODOs below.

Test Case

Hello wasi http

Steps to Reproduce

These steps fail on Ubuntu 24.04/riscv64 on VisionFive 2 and on Ubuntu 18.04/aarch64 on Nvidia Jetson Nano.

  • Build the hello wasi http code as described here
  • run wasmtime serve target/wasm32-wasi/debug/hello_wasi_http.wasm

Expected Results

I would have expected the tutorial to work as described.

Actual Results

jetson@360lab-nano2:~/docker/hello-wasi-http$ wasmtime serve -O pooling-allocator=y target/wasm32-wasi/debug/hello_wasi_http.wasm
Error: failed to create memory pool mapping                                                                                                                                                                                                     Caused by:
    0: mmap failed to reserve 0x5dc80000000 bytes
    1: Cannot allocate memory (os error 12)

When running without pooling allocator it works:

jetson@360lab-nano2:~/docker/hello-wasi-http$ wasmtime serve -O pooling-allocator=n target/wasm32-wasi/debug/hello_wasi_http.wasm
Serving HTTP on http://0.0.0.0:8080/

Versions and Environment

Wasmtime version or commit: 21.0

Operating system:

  • For RISCV64 Ubuntu 24.04 downloaded from here
  • For Aarch64 Ubuntu 18.04 downloaded from here

Architecture:

  • Riscv64
  • Aarch64

Extra Info

I guess there should be a way to detect the virtual address size as it seems to be around 39 bits in these architectures.

@matsbror matsbror added the bug Incorrect behavior in the current implementation that needs fixing label May 13, 2024
alexcrichton added a commit to alexcrichton/wasmtime that referenced this issue May 13, 2024
This commit aims to address bytecodealliance#8607 by dynamically determining whether the
pooling allocator should be used rather than unconditionally using it.
It looks like some systems don't have enough virtual memory to support
the default configuration settings so this should help `wasmtime serve`
work on those systems.

Closes bytecodealliance#8607
@alexcrichton
Copy link
Member

In lieu of directly probing address space limitations I've opted to do something slightly different in #8610 which probes for a large reservation to succeed before attempting another one for the pooling allocator.

@matsbror
Copy link
Author

Thanks. Will this also help spin, which uses wasmtime as library? The same error occurs there.

@alexcrichton
Copy link
Member

Not directly, no, but I can propose the same change on Spin to have the same effect

github-merge-queue bot pushed a commit that referenced this issue May 14, 2024
This commit aims to address #8607 by dynamically determining whether the
pooling allocator should be used rather than unconditionally using it.
It looks like some systems don't have enough virtual memory to support
the default configuration settings so this should help `wasmtime serve`
work on those systems.

Closes #8607
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior in the current implementation that needs fixing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants