Repository navigation
fix(win): buffer attachment updates - #174
Merged
Merged
Conversation
Expose `CrashpadClient::RegisterHandlers()` so sentry-native can restore the Windows crash handlers after another runtime replaces them, such as Unity installing its own handlers. Without access to this method, `sentry_reinstall_backend()` shuts down and starts the backend again. This launches another handler process and reloads breadcrumbs into the existing ring, duplicating them. Exposing the registration method lets the SDK preserve its client, handler process, IPC pipe, and breadcrumb state. Ref: getsentry/sentry-native#2182
The attachment IPC round trip waits for acknowledgment, which is sent before the request's disk write. The write then continues on the pipe service thread, keeping that pipe instance occupied. Later breadcrumb or scope updates can block on disk I/O from earlier requests when both instances are busy. Acknowledging before storing also allows consecutive updates to reach the delegate out of order, so a truncating write can erase a later append. Buffer each writable file under `attachments_lock_` before acknowledging its update. Writes replace pending content and appends extend it. Flush the buffers while the client is suspended, before resolving attachments or reading the external crash reporter envelope. Both crash dumps and `DumpWithoutCrash` use this path. Append-only updates extend preloaded file contents, while truncation keeps breadcrumb buffers bounded as the ring rotates. The handler kept across sentry-native backend reinstall preserves these pending updates. Ref: getsentry/sentry-native#2182
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e4f0317. Configure here.
The external crash reporter path deletes the database report, so the envelope is the only artifact. Flush again under the envelope lock so an update stored during the dump is included. The map is empty after the first flush, so only late arrivals are written.
JoshuaMoelans
approved these changes
Oct 12, 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.

An attachment IPC update waits for acknowledgment, which is correctly sent before the request's disk write. However, when the handler proceeds to the disk write, it keeps the instance busy and therefore indirectly blocks any potential other incoming updates during the I/O. In essence, during heavy congestion, later IPC updates can block on disk I/O from earlier requests when both instances are busy.
Avoid that by buffering attachment IPC updates before acknowledging them. Writes replace pending content and appends extend it, and flush the buffers when appropriate.
Note:
RegisterHandlersis made public on Windows to allow sentry-native's backend reinstall to preserve the attachment IPC update buffer.Ref: getsentry/sentry-native#2182