Repository navigation
Description
Description
I'm testing Sentry-native and Breakpad on my macOS machine. I've found that if I introduce a pointer access violation or send a SIGABRT signal, crash reports are successfully sent to the Sentry website. However, when I send a SIGSEGV signal to my program, although the crash information is visible in the local macOS console, no crash information is sent to the remote Sentry website. I've tried this multiple times without success. I also tried SIGFPE, SIGILL, and SIGBUS signals, and none of them resulted in crash reports being sent to Sentry. Previously, when I was using crashpad_handler, SIGSEGV signals were correctly sending crash information to Sentry. (My program has 10 processes, which results in 10 additional crashpad_handler processes, significantly increasing CPU and memory consumption, so I'm switching to the Breakpad solution.)
The only thing I've noticed is that when the SIGSEGV signal occurs, the content length of the crash information being sent is very short, only around 300 bytes. Normal crash information is usually over 100,000 bytes. Can you please help me analyze this? Thank you very much.
Environment
MacOS 15.2
sentry-native 0.7.20
- OS: [e.g. Windows 10, 64-bit] MacOS 15.2
- Compiler: [e.g. MSVC 19] clang
Log output
* Host o167200.ingest.us.sentry.io:443 was resolved.
* IPv6: (none)
* IPv4: 34.120.195.249
* Trying 34.120.195.249:443...
* Connected to o167200.ingest.us.sentry.io (34.120.195.249) port 443
* ALPN: curl offers h2,http/1.1
* CAfile: /etc/ssl/cert.pem
* CApath: none
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256 / [blank] / UNDEF
* ALPN: server accepted h2
* Server certificate:
* subject: C=US; ST=California; L=San Francisco; O=Sentry; CN=ingest.sentry.io
* start date: Oct 3 00:00:00 2024 GMT
* expire date: Jul 29 23:59:59 2025 GMT
* subjectAltName: host "o167200.ingest.us.sentry.io" matched cert's "*.ingest.us.sentry.io"
* issuer: C=US; O=DigiCert Inc; CN=DigiCert Global G2 TLS RSA SHA256 2020 CA1
* SSL certificate verify ok.
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://o167200.ingest.us.sentry.io:443/api/4508799326420993/envelope/
* [HTTP/2] [1] [:method: POST]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: o167200.ingest.us.sentry.io]
* [HTTP/2] [1] [:path: /api/4508799326420993/envelope/]
* [HTTP/2] [1] [user-agent: sentry.native/0.7.20]
* [HTTP/2] [1] [accept: */*]
* [HTTP/2] [1] [x-sentry-auth: Sentry sentry_key=**can't be shown**, sentry_version=7, sentry_client=sentry.native/0.7.20]
* [HTTP/2] [1] [content-type: application/x-sentry-envelope]
* [HTTP/2] [1] [content-length: 337]
> POST /api/4508799326420993/envelope/ HTTP/2
Host: o167200.ingest.us.sentry.io
User-Agent: sentry.native/0.7.20
Accept: */*
x-sentry-auth:Sentry sentry_key=**can't be shown**, sentry_version=7, sentry_client=sentry.native/0.7.20
content-type:application/x-sentry-envelope
content-length:337
* upload completely sent off: 337 bytes
< HTTP/2 200
< server: nginx
< date: Thu, 17 Apr 2025 07:26:30 GMT
< content-type: application/json
< content-length: 2
< vary: origin, access-control-request-method, access-control-request-headers
< access-control-allow-origin: *
< access-control-expose-headers: x-sentry-error,x-sentry-rate-limits,retry-after
< cross-origin-resource-policy: cross-origin
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< via: 1.1 google
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
<
{}* Connection #0 to host o167200.ingest.us.sentry.io left intact
The below is my init func:
int
CrashHandlerInit(void)
{
if (g_sentry_inited) {
// Already inited
logMessage("Sentry already initialized.");
return -1;
}
if (getExecutableName() == false) {
logMessage("Failed to get executable name");
return -2;
}
ensureLogFilePermissions();
strncpy(g_branchName, GIT_BRANCH_NAME, sizeof(g_branchName) - 1);
strncpy(g_versionNum, BUILD_VERSION, sizeof(g_versionNum) - 1);
sentry_options_t *options = sentry_options_new();
// if support multi dsn platform, use a switch case here
// sentry_options_set_dsn(options, ctxDecodeString(DSN1));
sentry_options_set_dsn(options,
"https://*******");
// sentry_options_set_handler_path(options, CRASHPADPATH);
// (Because I'm not using Crashpad, I commented out that line.)
sentry_options_set_database_path(options, DATABASEPATH);
#ifdef ENVIRONMENT
sentry_options_set_environment(options, ENVIRONMENT);
#else
sentry_options_set_environment(options, "unknown");
#endif
sentry_options_set_release(options, g_branchName);
sentry_options_set_debug(options, 1);
sentry_options_set_logger(options, sentryLogger, NULL);
int ret = sentry_init(options);
if (ret != 0) {
logMessage("Failed to init Sentry with error code: %d with process "
"name:%s version:%s branch:%s",
ret, g_processName, g_versionNum, g_branchName);
return ret;
}
g_sentry_inited = true;
sentry_set_tag("processName", g_processName);
sentry_set_tag("branch", g_branchName);
sentry_set_tag("version", g_versionNum);
logMessage("Successfully initialized Sentry with process name: %s version: "
"%s branch: %s",
g_processName, g_versionNum, g_branchName);
return 0;
}The below is how i compile the sentry-native with breakpad:
cd build
cmake .. -DSENTRY_BACKEND=breakpad -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
cmake --build . --parallel
# Package the all items
INSTALL_DIR=./pkg
cmake --install . --prefix "$INSTALL_DIR"Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsNo status
Activity
zongyangbigpolo commentedon Apr 18, 2025
I tested version 0.8.4, and the Sentry website still can't display crash information for the SIGSEGV signal.
zongyangbigpolo commentedon Apr 18, 2025
0.8.4 log:
zongyangbigpolo commentedon Apr 18, 2025
The below is the normal log:
supervacuus commentedon Apr 20, 2025
TLDR: this is not a bug, but an essential difference between
breakpadandcrashpad(or any external crash handler) on macOS and one of the reasons whycrashpadis still the preferred backend on macOS (even though there are distribution complexities due to the handler).Can you explain what you are trying to achieve by sending synthetic fatal signals? Do you primarily use this for testing, or are you relying on it in your production setup?
This is expected behavior for
breakpador any in-process handler that primarily relies on Mach exception handling. The signals you are trying to send aren't usually coming from another process, but from the kernel, and with them a crash-context (ucontext) that contains all the essential information to allow a crash handler to create a report. If you send aSIGSEGVfrom another process, there is no data for the handler to act on.In addition to that, and more importantly in your case, a synthetic POSIX signal sent to a macOS process, bypasses the Mach exception port listener, which is the listener used by all handlers on macOS (except for the
inprocbackend); it would have to be handled by a signal handler. The reason for this is that while macOS supports POSIX signals, they are implemented through a compatibility layer; at its core, the kernel emits Mach exceptions.In any handler setup for a particular process, the kernel would first emit a Mach exception, and only if convertible and signal handlers are present, emit a signal second. Suppose you send a synthetic crash signal (like the ones you mentioned) from another process. In that case, there is nothing to report to the Mach exception port listener because the signal originates from another process, not as a converted Mach exception from the kernel. Since no signal handlers exist, the signal would end up in the default handler, leading to the signal log that you see, but no crash report from
breakpad.crashpadalso doesn't register a signal handler on macOS, but it is still able to retrieve the unhandled signal. This touches on a subtle difference in handling and conversion between POSIX signals and Mach exceptions on macOS. Independent from where it originated, once a terminal signal passes through the process unhandled (i.e., the process would terminate), macOS converts the signal, during process exit, back into aEXC_CRASHexception and delivers this Mach exception to any remaining port listener, besides in-process listeners.That is one of the essential upsides of using crashpad on macOS: its listener runs inside the
crashpad_handler(outside the monitored process), which receives that exception and then snapshots the crashed process at the last chance it can get. Whereas withbreakpad, the in-process handler wouldn't receive anything.What you are seeing is only a session request. No crash envelope is being sent.
zongyangbigpolo commentedon Apr 21, 2025
Thank you so much for your comprehensive and detailed answer, it has been extremely helpful to me.
supervacuus commentedon Apr 21, 2025
I am happy to hear. Please let me know if you have any further questions.