Fix multi-threading issues#2013
Merged
wenyongh merged 8 commits intobytecodealliance:mainfrom Mar 8, 2023
Merged
Conversation
Merge bytecodealliance:main into wenyongh:implement_atomic_fence
| wasm_cluster_thread_exited(exec_env); | ||
| #endif | ||
|
|
||
| os_mutex_lock(&cluster_list_lock); |
Collaborator
There was a problem hiding this comment.
Is this lock required by wasm_cluster_del_exec_env?
Had better update the comment for wasm_cluster_del_exec_env:
/* The caller should lock cluster->lock and
cluster_list_lock for thread safety */
Collaborator
Author
There was a problem hiding this comment.
No, this lock here is to lock
if (exec_env->wait_count == 0 && !exec_env->thread_is_detached) {
...
}wasm_cluster_del_exec_env only needs to lock cluster->lock
| return 0; | ||
| } | ||
|
|
||
| os_mutex_lock(&exec_env->cluster->lock); |
Collaborator
There was a problem hiding this comment.
Had better add comment for this function to ask the caller to ensure thread safety
Collaborator
Author
There was a problem hiding this comment.
Removing the code here since clusters_have_exec_env will lock again, which leads to hang.
eloparco
approved these changes
Mar 8, 2023
Collaborator
|
LGTM |
vickiegpt
pushed a commit
to vickiegpt/wamr-aot-gc-checkpoint-restore
that referenced
this pull request
May 27, 2024
- Implement atomic.fence to ensure a proper memory synchronization order - Destroy exec_env_singleton first in wasm/aot deinstantiation - Change terminate other threads to wait for other threads in wasm_exec_env_destroy - Fix detach thread in thread_manager_start_routine - Fix duplicated lock cluster->lock in wasm_cluster_cancel_thread - Add lib-pthread and lib-wasi-threads compilation to Windows CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.