-
Notifications
You must be signed in to change notification settings - Fork 647
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
Add internal tests for WASI threads #1963
Add internal tests for WASI threads #1963
Conversation
afa80d0
to
99b8f88
Compare
99b8f88
to
bfeeb62
Compare
baa0c58
to
878efac
Compare
3f38ec1
to
69242fc
Compare
6127a8f
to
986db41
Compare
c4b1654
to
120c146
Compare
83a8f2c
to
ccce28b
Compare
CI reported error: Test nonmain_proc_exit_sleep failed
[exit_code] 33 == 250
STDOUT:
STDERR:
double free or corruption (fasttop) Any idea about that? |
6e50016
to
584da41
Compare
I rebased the PR on top of For the tests in this PR, I mainly see two kind of issues:
The investigation is still on. |
Yes, seems that the "double free or corruption (fasttop)" error had been reported by CI when running
OK, seems the first issue is caused by runtime and the second is caused by wasi-libc itself. |
OK, thanks, I will try looking into it. |
@wenyongh Great! I just tried the changes, and they seem to fix the remaining race conditions I was seeing.
But that should be fairly easy to fix. I tried many runs in classic interpreter mode, I still need to check with AOT. |
OK, I have merged that PR, maybe you can rebase this PR with main branch, and if CIs run OK, I will merge it. |
- name: build wasi-libc (needed for wasi-threads) | ||
if: matrix.test_option == '$WASI_TEST_OPTIONS' | ||
run: | | ||
mkdir wasi-libc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we upgrade to wasi-sdk 20, so we don't need to build libc from git?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'm addressing that in a separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think I should update it everywhere in the CI or only for the parts where WASI threads are used?
eloparco@4b8c49e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had better update here only since we claimed in the document that we support the wasi-sdk 19.0+, we had better use it by default in the CI files.
https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/build_wasm_app.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it here eloparco@006534c. It works on MacOS but not on Ubuntu 20.04, as we observed in the past (because of the glibc version installed there).
https://github.com/eloparco/wasm-micro-runtime/actions/runs/4379797818/jobs/7666263974
https://github.com/eloparco/wasm-micro-runtime/actions/runs/4379796629/jobs/7666151109
We can use wasi-sdk-20 pre-release in case of Ubuntu 22.04 and keep using wasi-libc for wasi-sdk-19 on Ubuntu 20.04, making sure that in case of wasi-sdk-19 we specify WASI_SYSROOT
. What do you think?
Maybe I should create a PR anyway and we can discuss there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good, at least we don't need to build wasi-libc in Ubuntu 22.04. And we can update CI again when the wasi-sdk-20 is actually released. Not sure whether the glibc version issue on Ubuntu 20.04 will be resolved in wasi-sdk-20.0? Or should we file an issue in wasi-sdk community, or upload a PR to help resolve the issue?
Fixed a data race when deleting wait_info in wasm_shared_memory, spotted with main_proc_exit_wait.c from this PR |
95e9f1e
to
7aafc8d
Compare
Yes, let's do that so it's easier to use the tests without applying patches or cherry-picking. They seem to succeed now (I tried many runs) and the data races seem gone (apart from the ones related to load/store operations). |
OK, I merged it. |
CI run failure: ./test_wamr.sh -m x86_32 -P $WASI_TEST_OPTIONS -t classic-interp
...
Test nonmain_proc_exit_sleep failed
[exit_code] 33 == 0
STDOUT:
STDERR: |
Add internal tests for WASI threads (bytecodealliance#1963)
Locally, in classic interpreter mode, I tried multiple runs of I didn't try with |
I am not sure, I tested it many times with both iwasm x86_64 and x86_32, but also cannot reproduce the issue. But for Failed to spawn a new thread
Exception: out of bounds memory access I didn't reproduce it with iwasm x86_64, but it easily occurs with iwasm x86_32. |
Ok, that may be caused by the fact that the |
OK, could we add lock to malloc for this case? And not sure whether there will be a thread-safe malloc in future version of wasi-libc? |
Done #2022 |
Fix a data race for test main_proc_exit_wait.c from #1963. And fix atomic_wait logic that was wrong before: - a thread 1 started executing wasm instruction wasm_atomic_wait but hasn't reached waiting on condition variable - a main thread calls proc_exit and notifies all the threads that reached waiting on condition variable Which leads to thread 1 hang on waiting on condition variable after that Now it's atomically checked whether proc_exit was already called.
Add internal tests for WASI threads. These tests are run in addition to the ones in the proposal: https://github.com/WebAssembly/wasi-threads/tree/main/test/testsuite. The purpose is to test additional and more complex scenarios.
…odealliance#2016) Fix a data race for test main_proc_exit_wait.c from bytecodealliance#1963. And fix atomic_wait logic that was wrong before: - a thread 1 started executing wasm instruction wasm_atomic_wait but hasn't reached waiting on condition variable - a main thread calls proc_exit and notifies all the threads that reached waiting on condition variable Which leads to thread 1 hang on waiting on condition variable after that Now it's atomically checked whether proc_exit was already called.
Add internal tests for WASI threads. These tests are run in addition to the ones in the proposal https://github.com/WebAssembly/wasi-threads/tree/main/test/testsuite.
The purpose is to test additional and more complex scenarios.