Skip to content

Fix crash in SentryMetricProfiler.recordCPUsage #4581

@philipphofmann

Description

@philipphofmann

Description

The SDK sometimes crashes with NSInvalidArgumentException in SentryMetricProfiler.recordCPUsage.

Exception Type: EXC_CRASH (SIGABRT)

Thread 0 Crashed:
0   CoreFoundation                  0x19118a2e0         __exceptionPreprocess
1   libobjc.A.dylib                 0x190c6e154         objc_exception_throw
2   CoreFoundation                  0x19123c568         -[NSObject(NSObject) doesNotRecognizeSelector:]
3   CoreFoundation                  0x1910f3f38         ___forwarding___
4   CoreFoundation                  0x1910f384c         __forwarding_prep_0___
5   Sentry.framework                0x1044b7ea8         -[SentryMetricProfiler recordCPUsage] (Sentry.framework:267)
6   Sentry.framework                0x1044b70cc         -[SentryMetricProfiler recordMetrics] (Sentry.framework:136)
7   Sentry.framework                0x1044b7a3c         __39-[SentryMetricProfiler registerSampler]_block_invoke (Sentry.framework:232)

We see this also in our internal SDK crash detection.

Originally reported here: #4579.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions