Return error when exception encountered after main thread finishes#2169
Merged
wenyongh merged 1 commit intobytecodealliance:mainfrom May 5, 2023
Conversation
wenyongh
reviewed
May 3, 2023
Comment on lines
+750
to
+753
| if (wasm_runtime_get_exception(wasm_module_inst)) { | ||
| /* got an exception in spawned thread */ | ||
| ret = 1; | ||
| } |
Collaborator
There was a problem hiding this comment.
Should also apply similar changes in file product-mini/platforms/windows/main.c
e531a9f to
17b6825
Compare
yamt
added a commit
to yamt/wasm-micro-runtime
that referenced
this pull request
Aug 31, 2023
…shes (bytecodealliance#2169)" This reverts commit 71d43f3. for some reasons, the original commit assumes a trap should win over exit even if the former is 1 second later. i don't see any reason it should.
yamt
added a commit
to yamt/wasm-micro-runtime
that referenced
this pull request
Aug 31, 2023
…shes (bytecodealliance#2169)" This reverts commit 71d43f3. for some reasons, the original commit assumes a trap should win over an exit even if the former is 1 second behind the latter. i don't see any reason it should. in that case, the expected behavior is that the exit likely wins and the other thread won't even reach the code to raise a trap.
yamt
added a commit
to yamt/wasm-micro-runtime
that referenced
this pull request
Aug 31, 2023
…shes (bytecodealliance#2169)" This reverts commit 71d43f3. for some reasons, the original commit assumes a trap should win over an exit even if the former is 1 second behind the latter. i don't see any reason it should. in that case, the expected behavior is that the exit likely wins and the other thread won't even reach the code to raise a trap.
yamt
added a commit
to yamt/wasm-micro-runtime
that referenced
this pull request
Sep 4, 2023
…shes (bytecodealliance#2169)" This reverts commit 71d43f3. for some reasons, the original commit assumes a trap should win over an exit even if the former is 1 second behind the latter. i don't see any reason it should. in that case, the expected behavior is that the exit likely wins and the other thread won't even reach the code to raise a trap.
vickiegpt
pushed a commit
to vickiegpt/wamr-aot-gc-checkpoint-restore
that referenced
this pull request
May 27, 2024
…tecodealliance#2169) Currently, if a thread is spawned and raises an exception after the main thread has finished, iwasm returns with success instead of returning 1 (i.e. error). Since wasm_runtime_get_wasi_exit_code waits for all threads to finish and only returns the wasi exit code, this PR performs the exception check again and returns error if an exception was raised.
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.
Currently, if a thread is spawned and raises an exception after the main thread has finished already,
iwasmreturns with success, instead of returning1(i.e. error).Since
wasm_runtime_get_wasi_exit_codewaits for all threads to finished, the exception check has to performed again after all threads have finished.