-
Notifications
You must be signed in to change notification settings - Fork 263
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
On arm64, I get "cannot allocate memory (os error 12)" on executing spin up command #2119
Comments
@alexcrichton would probably know where to look first. Wasmtime does do a 2GB allocation for guard pages (see https://docs.wasmtime.dev/contributing-architecture.html#linear-memory for details), which is what seems to be failing here. That should only require virtual address space, not physical memory, though. There may be a way to disable the guard region in exchange for slower runtime performance (e.g. Wasmtime will need to do explicit checks for each memory access), but I'd be surprised if that's necessary -- even on a Raspberry Pi. cc @jpflueger since I believe he's run Spin on Raspberry Pi in the past. |
This is probably one of two things happening:
I dunno what to do if it's (2) but you're probably running into (1). You can test this out by frobbing some env vars configured here, the main one being The error here is about the "stack pool mapping" which happens here, notably after the memory/table pools were already configured. That means that most of virtual memory has already been reserved which is what leads me to think that this is address space exhaustion and turning down the knobs may be able to help. If this does help it's something that can be exposed programmatically or perhaps through auto-detection too. |
how can I make a build of spin where the value of |
@theagilecoder these are environment variables, so you just need to run |
@rylev I try above suggestion with 1gb RAM aws amazon linux, build successful but |
@theagilecoder or @siashish can you post the output of running |
To validate an assumption here, could you test by passing the Thanks! |
https://discord.com/channels/926888690310053918/1215979463918096424/1216015906941964418 |
Is running with |
I did some experiments on AWS where I had the same issues as described above and found the following:
But as @seungjin already mentioned: What are the implications of running with |
My workaround for now is giving additional 2G swapfile. Since I am purposing my app for self-hosting, I am targeting mostly provided freetire VMs(AWS, Google, Azure) which is 2cores(X86_64), 1G ram machine. |
Under some circumstances you would expect reduced performance under high load. That is probably not a major concern on these "small" systems so disabling pooling is appropriate. I think it would be reasonable to detect systems with <2GB (?) RAM and just disable pooling, assuming it would be significantly more effort to fine-tune pooling settings. |
I find it a bit puzzling that the pooling allocator fails here: it really shouldn't cause all that much additional real memory usage over the on-demand allocator. I wonder if these systems also restrict the amount of virtual memory available? And if so, is that something we can detect? |
I think this is likely, via either the |
This commit is intended to address spinframework#2119 and mirror bytecodealliance/wasmtime#8610. The base problem is that some systems are configured with smaller amounts of virtual memory than other systems, for example some aarch64 and riscv64 systems are shown to have only 39 bits of virtual address space rather than the 48 by default on x86_64. This means that the pooling allocator can't be initialized on these platforms since it needs more virtual memory than that. This changes Spin to dynamically choosing whether to use the pooling allocator. It's still used by default in Wasmtime but a dynamic probe is performed to determine whether it's going to work first. While here I also added an env var to control this behavior for an escape hatch if that's needed in the future too. Closes spinframework#2119
This commit is intended to address spinframework#2119 and mirror bytecodealliance/wasmtime#8610. The base problem is that some systems are configured with smaller amounts of virtual memory than other systems, for example some aarch64 and riscv64 systems are shown to have only 39 bits of virtual address space rather than the 48 by default on x86_64. This means that the pooling allocator can't be initialized on these platforms since it needs more virtual memory than that. This changes Spin to dynamically choosing whether to use the pooling allocator. It's still used by default in Wasmtime but a dynamic probe is performed to determine whether it's going to work first. While here I also added an env var to control this behavior for an escape hatch if that's needed in the future too. Closes spinframework#2119 Signed-off-by: Alex Crichton <[email protected]>
This came up in bytecodealliance/wasmtime#8607 and on the bytecodealliance Zulip and I think I got a fix for this in Wasmtime which I've ported over to Spin as well |
This commit is intended to address spinframework#2119 and mirror bytecodealliance/wasmtime#8610. The base problem is that some systems are configured with smaller amounts of virtual memory than other systems, for example some aarch64 and riscv64 systems are shown to have only 39 bits of virtual address space rather than the 48 by default on x86_64. This means that the pooling allocator can't be initialized on these platforms since it needs more virtual memory than that. This changes Spin to dynamically choosing whether to use the pooling allocator. It's still used by default in Wasmtime but a dynamic probe is performed to determine whether it's going to work first. While here I also added an env var to control this behavior for an escape hatch if that's needed in the future too. Closes spinframework#2119 Signed-off-by: Alex Crichton <[email protected]>
This is regarding the quickstart from the docs.
It runs on my X86 laptops just fine. But on arm64 platforms such as Raspberry Pi 3 (1 gb ram) or Arm based EC2 instances(with 2 GB ram),
spin build
works without any issues but onspin up
I get the following error:Am I low on ram ? do I need more for Arm ?
![Screenshot (20)](https://private-user-images.githubusercontent.com/5019222/286278753-04d599b0-e158-4627-b3bd-8ad16711d0a4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MjA4ODIsIm5iZiI6MTczOTQyMDU4MiwicGF0aCI6Ii81MDE5MjIyLzI4NjI3ODc1My0wNGQ1OTliMC1lMTU4LTQ2MjctYjNiZC04YWQxNjcxMWQwYTQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTNUMDQyMzAyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YjQyNzM1ZmY2YjliNjY4Nzc2MDA5NGI3N2IyY2FlOGI3OTNkOTIzZjc3ODRhYzllN2Q4ZTZkZDkxNjc3ZTcwOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.xeXxnC6uiNKy15ZIEio_bgTSd6p_Qzzv1_DlMPGdEfE)
Image attached.
The text was updated successfully, but these errors were encountered: