Skip to content

Sentry-native + Breakpad is failing to show SIGSEGV crash info. #1203

@zongyangbigpolo

Description

@zongyangbigpolo

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

No one assigned

    Labels

    Bugsomething isn't working as it should
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions