Repository navigation
fix(android): handle unwinder allocation failures - #2239
Merged
Merged
Conversation
libunwindstack throws `std::bad_alloc` from `Maps::Parse` when an allocation fails, e.g. at the mapping limit. Uncaught on the inproc handler thread, it aborted the process, and the tombstone reported the abort instead of the original crash. Catch exceptions in `sentry__unwind_stack_libunwindstack` and fall back to the crash PC, as for unparsable maps. Allocate the handler thread's C++ exception state at startup with `sentry__unwind_init`, because the NDK's C++ runtime aborts if the first throw on a thread fails to allocate it. Fixes: #2235
Allocate the thread's C++ exception state with `__cxa_get_globals` instead of a throw/catch. Per new thread on a Pixel 8 Pro (NDK 29, `c++_static`), averaged over 200 threads: - throw/catch: ~120 us, ~300 us for the first throw in the process - `__cxa_get_globals`: ~7 us
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2239 +/- ##
==========================================
+ Coverage 75.63% 75.70% +0.06%
==========================================
Files 103 103
Lines 28263 28266 +3
Branches 5180 5180
==========================================
+ Hits 21378 21400 +22
+ Misses 5540 5522 -18
+ Partials 1345 1344 -1 π New features to boost your workflow:
|
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 74396c9. Configure here.
This reverts commit 74396c9.
mujacica
approved these changes
Oct 23, 2026
Merged
1 of 6 tasks
1 of 2 tasks
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.

libunwindstack throws
std::bad_allocfromMaps::Parsewhen an allocation fails, e.g. at the mapping limit. Uncaught on the inproc handler thread, it aborted the process, and the tombstone reported the abort instead of the original crash.Catch exceptions in
sentry__unwind_stack_libunwindstackand fall back to the crash PC, as for unparsable maps. Allocate the handler thread's C++ exception state at startup withsentry__unwind_init, because the NDK's C++ runtime aborts if the first throw on a thread fails to allocate it.Fixes: #2235