fix(native): prevent shared memory leak on crash#1664
Merged
Conversation
Each native-backend crash leaks a /dev/shm/s-<id> entry: the app's _free only runs on clean shutdown, and the daemon previously never unlinked. Under Docker's default 64 MB /dev/shm a few dozen leaks fill the tmpfs; the next ftruncate succeeds (lazy) but the first page-fault from memset takes a SIGBUS and the app dies silently. Add sentry__crash_ipc_unlink() and call it from the daemon's cleanup path when crash_processed is set or the parent is no longer alive. Keep the !is_daemon guard in _free so the app still owns the unlink during normal shutdown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4c53d11. Configure here.
/dev/shm leak on crash4c53d11 to
affcb93
Compare
mujacica
approved these changes
Apr 23, 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.

The native backend was leaking a
/dev/shm/s-<id>entry per crash. The app'ssentry__crash_ipc_freeonly unlinks during clean shutdown, and the daemon never unlinked. Under Docker's default 64 MB/dev/shm, a few dozen crashes fill the tmpfs and the nextmemsetpage-faultSIGBUSes silently. Surfaced in #1545, which adds more native crash tests.Add
sentry__crash_ipc_unlinkand call it from the daemon's cleanup path whencrash_processed || !is_parent_alive. The app keeps unlinking from its ownsentry__crash_ipc_freevia the existing!is_daemonguard, so it still owns the unlink during normal teardown.