getsentry / getsentry/sentry-cocoa

There's an 100-thread limit in crash reports

Open
#4,006 5 comments 0 reactions 0 assignees View on GitHub
Cocoa Errors Improvement
Dominant language
Swift
Stars
1.1k
Forks
418
Avg merge
2d 3h
Merged PRs (30d)
106

Description

### Platform

macOS

### Environment

Production

### Installed

Manually

### Version

8.22.1

### Xcode Version

15.1

### Did it work on previous versions?

_No response_

### Steps to Reproduce

The code below tries to make the thread 100 crash. Apple's crash report shows that thread 108 (some additional threads were automatically created by Cocoa, I think) crashed indeed. However, the crash report on the Sentry server doesn't show the crashed thread (108); thread 0 is shown by default instead. Also, the Threads dropdown only contains threads 0 to 99, so the crashed thread is not even in the dropdown. I checked the local .json crash report in the SentryCrash folder; it doesn't seem to have the crashed thread either. Thus, I think there's a 100-thread limit. Could we increase it or at least show the crashed thread at the top of the dropdown?

```
#include
#include

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
const int numThreads = 101;
std::vector threads;
for (int i = 0; i < numThreads; ++i)
{
if (i == numThreads - 1)
{
threads.emplace_back([]() {
int* x = nullptr;
*x = 10;
});
}
else
{
threads.emplace_back([]() {
std::this_thread::sleep_for(std::chrono::seconds(1));
});
}
}

for (auto& worker : threads)
{
worker.join();
}
}
```

### Expected Result

The crashed thread (108) is at the top of the Threads dropdown, and its backtrace is also shown.

### Actual Result

The thread 0 is at the top of the Threads dropdown, and its backtrace is shown instead.
Screenshot_2024-05-21_at_1 15 00_PM
[test_sentry_with_memmove-report-000000009c800000.json](https://github.com/getsentry/sentry-cocoa/files/15407904/test_sentry_with_memmove-report-000000009c800000.json)

### Are you willing to submit a PR?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.