Skip to content

WIP: feat(native): introduce WER mode for better WER interop#1833

Closed
jpnurmi wants to merge 2 commits into
masterfrom
jpnurmi/feat/native/wer-mode
Closed

WIP: feat(native): introduce WER mode for better WER interop#1833
jpnurmi wants to merge 2 commits into
masterfrom
jpnurmi/feat/native/wer-mode

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Allow configuring whether SEH and fast-fail crashes propagate to WER.

Comment thread include/sentry.h
Comment on lines +1140 to +1146
* SEH crashes: the SDK's unhandled exception filter returns
* `EXCEPTION_CONTINUE_SEARCH`, which proceeds with normal exception
* handling and lets WER also process the crash.
* Fast-fail crashes: the WER module does not claim ownership, allowing WER
* to also process them.
*/
SENTRY_WER_MODE_SHARED = 2,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The SEH crash handler crash_exception_filter unconditionally returns EXCEPTION_CONTINUE_SEARCH, ignoring the wer_mode for SENTRY_WER_MODE_EXCLUSIVE and SENTRY_WER_MODE_NONE.
Severity: HIGH

Suggested Fix

Add logic to the crash_exception_filter function to check ctx->wer_mode. It should return EXCEPTION_EXECUTE_HANDLER for SENTRY_WER_MODE_EXCLUSIVE and SENTRY_WER_MODE_NONE, and EXCEPTION_CONTINUE_SEARCH for SENTRY_WER_MODE_SHARED.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: include/sentry.h#L1140-L1146

Potential issue: The SEH crash handler in `src/backends/native/sentry_crash_handler.c`,
specifically the function `crash_exception_filter`, unconditionally returns
`EXCEPTION_CONTINUE_SEARCH`. This contradicts the documented behavior for
`SENTRY_WER_MODE_EXCLUSIVE` and `SENTRY_WER_MODE_NONE`, which require the function to
return `EXCEPTION_EXECUTE_HANDLER` to prevent Windows Error Reporting (WER) from
processing the crash. The implementation fails to check the `ctx->wer_mode`, thus
violating the API contract and causing incorrect WER interop behavior for SEH crashes on
Windows.

Did we get this right? 👍 / 👎 to inform future reviews.

@jpnurmi jpnurmi changed the title feat(native): introduce WER mode for better WER interop WIP: feat(native): introduce WER mode for better WER interop Jun 30, 2026
@jpnurmi jpnurmi closed this Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant