-
Notifications
You must be signed in to change notification settings - Fork 644
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
Native stack overflow issue when issuing wasm_runtime_init_thread_env() API #3909
Comments
Is it still Ubuntu, or is it MacOS or Windows? |
It is still Ubuntu on ARM platform |
Running this on iwasm-1.3.2 After putting additional debug we observe the issue is in the below call flow when we invoke wasm_runtime_init_thread_env(): In touch_pages() seems like after a point os_alloca() leads to the native stack overflow error. I observed touch_pages called even during wasm_runtime_init() and for that function I see the touch_pages() API returns succesfully. Attaching the logs with debug prints leading upto the error:
Would appreciate if someone can help understand when would os_alloca() call cause stack overflow and how can this issue be resolved. |
Building iwasm with the below flags, attaching trimmed patch:
|
I was able to go past the issue on my AARCH platform by building iwasm with |
Could you print the The If if (touch_addr < stack_min_addr + page_size) {
sum += *(stack_min_addr + page_size - 1);
break;
} |
Basically this flag does is that for each thread's stack, WAMR calculates the stack boundary for it and sets a guard page for it(touch it will raise a signal), to keep it from stack overflow. When you disable it, chances are you are fine, it's not that easy to actually cause a stack overflow in normal cases. |
Just as a hint: I experience the same problem on Linux aarch64 (Virtual Machine on a Mac) with WAMR-1.3.3. Did not upgrade for a long time. Everything worked fine, in the commit I used for a long time, maybe this helps locating the issue.
|
Hi All,
I have developed a WASM containerized application. I run the application using iwasm runtime. I have a scenario where the WASM application registers a callback with the native library. I am using the below sequence of APIs to lookup and invoke the callback from the native library:
The above code works just fine on my x86 Ubuntu machine, however when I try running the same application on my ARM platform I see the below error:
Exception: native stack overflow
I narrowed it down and found
wasm_runtime_init_thread_env()
API is leading to this error.I tried increassing the stack and heap size allocation when starting the application but that doesn't seem to help. Is there something missing here or am I using the wrong WASM runtime APIs?
The text was updated successfully, but these errors were encountered: