windows: fix vectored exception handler lifecycle for repeated thread env init/destroy#4842
Open
kogum4 wants to merge 2 commits intobytecodealliance:mainfrom
Open
windows: fix vectored exception handler lifecycle for repeated thread env init/destroy#4842kogum4 wants to merge 2 commits intobytecodealliance:mainfrom
kogum4 wants to merge 2 commits intobytecodealliance:mainfrom
Conversation
Contributor
TianlongLiang
left a comment
There was a problem hiding this comment.
This PR overall LGTM with one minor comments
Since the code is already inside #ifdef BH_PLATFORM_WINDOWS, the macro is always defined. Use NULL directly for clarity. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TianlongLiang
approved these changes
Feb 26, 2026
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.
Summary
This PR fixes Windows VEH lifecycle handling for repeated runtime/thread-env init-destroy cycles.
On Windows host integrations that repeatedly unload/reload WASM runtime users, stale VEH state could remain and later crash in
ntdllexception dispatch.Reproduction (before)
On Windows, in a host-like lifecycle that repeatedly creates/destroys runtime usage contexts (including thread env init/destroy churn), intermittent crashes were observed in exception dispatch (
ntdll, access violation path) after unload/reload cycles.Changes
File:
core/iwasm/common/wasm_runtime_common.cWhat changed:
0 -> 11 -> 0RemoveVectoredExceptionHandlerfails, keep retry-able ownership state instead of dropping handler stateBehavior change
Validation
Notes
No new WAMR-internal test is included in this patch; validation was performed in the integration lifecycle where the issue reproduces.
If maintainers prefer, I can submit a follow-up PR with a WAMR-side regression test for this lifecycle pattern.