Skip to content

feat: support attaching bytes on Windows and Linux#127

Closed
jpnurmi wants to merge 3 commits intogetsentry:getsentryfrom
jpnurmi:feat/attach-bytes
Closed

feat: support attaching bytes on Windows and Linux#127
jpnurmi wants to merge 3 commits intogetsentry:getsentryfrom
jpnurmi:feat/attach-bytes

Conversation

@jpnurmi
Copy link
Copy Markdown
Collaborator

@jpnurmi jpnurmi commented Jun 16, 2025

This PR adds Crashpad-side support for:

The existing IPC uses fixed-size structs over named pipes on Windows and Unix domain sockets on Linux. When attaching arbitrary sequences of bytes, the expected size is sent in the kAddAttachment message, and the respective bytes are sent as a separate trailing payload message. A UUID identifies each attachment, to make it possible to remove them later.

@jpnurmi jpnurmi force-pushed the feat/attach-bytes branch from 154d352 to 6066efd Compare June 16, 2025 16:23
@jpnurmi jpnurmi force-pushed the feat/attach-bytes branch from 6066efd to 23f842f Compare June 16, 2025 16:28
@jpnurmi jpnurmi marked this pull request as ready for review June 17, 2025 10:30
@jpnurmi
Copy link
Copy Markdown
Collaborator Author

jpnurmi commented Jun 17, 2025

@supervacuus Is this an acceptable deviation from the upstream? I understand well it's not good for future updates if the diff grows too much...

Alternatively, we could decide not to support attaching bytes with the Crashpad backend, even though it might get quite confusing to explain the supported vs. unsupported attachment scenarios in the docs. 😅 With this, we would achieve the same level of support for file and byte attachments.

@supervacuus
Copy link
Copy Markdown
Collaborator

I will give this a deeper inspection tomorrow, but from a quick scan, I wouldn't worry about the diff being unmaintainable. We have already introduced quite considerable changes to Crashpad; Sentry has implemented a significant portion of the current attachment implementation you built on, so modifying attachment behavior is the least of my worries.

@jpnurmi jpnurmi marked this pull request as draft June 17, 2025 18:49
@jpnurmi
Copy link
Copy Markdown
Collaborator Author

jpnurmi commented Jun 17, 2025

The Windows implementation can handle 99MB (Sentry's limit 100MB minus leaving room for other stuff in the envelope/request).

The Linux implementation needs more work. It cannot handle larger payloads than a few hundred KB (wmem_max). I should have tested this earlier...

@supervacuus
Copy link
Copy Markdown
Collaborator

The Windows implementation can handle 99MB (Sentry's limit 100MB minus leaving room for other stuff in the envelope/request).

The Linux implementation needs more work. It cannot handle larger payloads than a few hundred KB (wmem_max). I should have tested this earlier...

Why not use IPC solely for metadata transmission and do the actual attachment payload transfer via the file system? We already have the buffer in memory on the client side. There is no need to transfer it into the memory of the crashpad_handler.

The fact that we provide a memory buffer interface does not mean the interface towards the crashpad_handler has to be the same. If there is a significant difference between file- and buffer-based attachments, it lies in the point at which the actual data is read. Buffer interfaces will always be eager, and as such, we wouldn't introduce any weirdness by storing them right away.

@jpnurmi
Copy link
Copy Markdown
Collaborator Author

jpnurmi commented Jun 18, 2025

Why not use IPC solely for metadata transmission and do the actual attachment payload transfer via the file system? We already have the buffer in memory on the client side. There is no need to transfer it into the memory of the crashpad_handler.

Yeah, let's try that. It will make things simpler. I noticed the Crashpad server eventually writes it to the disk together with the crash report anyway.

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.

2 participants