newrelic / newrelic-ios-agent-spm

This repository hosts the Swift Package Manager deployment of the iOS agent
Apache License 2.0
15 stars 9 forks source link

NSStringFromNRMAMeasurementType crash #58

Open asos-chrisblackmore opened 3 weeks ago

asos-chrisblackmore commented 3 weeks ago

Description

Since upgrading to 7.5.0, our customer facing app is seeing a crash relating to NSStringFromNRMAMeasurementType.

Screenshot 2024-08-22 at 14 31 46

We've been forced to pause our rollout since this crash is one of the highest in our app.

Steps to Reproduce

Unknown

Expected Behavior

The app to not crash.

cdillard-NewRelic commented 3 weeks ago

Please update to 7.5.1 where we fixed this. Thanks!

asos-chrisblackmore commented 3 weeks ago

@cdillard-NewRelic Great, thanks! Is it worth mentioning that in the release notes to visibility? I'd imagine we're not the only vendors experiencing this.

asos-chrisblackmore commented 2 weeks ago

@cdillard-NewRelic We've just upgraded and released a new version - the crash is still there but now with a different stack trace: Screenshot 2024-08-29 at 08 31 25

cdillard-NewRelic commented 2 weeks ago

Ah, thank you for reporting that. We've created a ticket locally to look into this NR_dispatch_once crash for our next release.

smalsam-newr commented 2 weeks ago

@asos-chrisblackmore Please post a full crash report for this issue when you are able, thank you.

asos-chrisblackmore commented 2 weeks ago

@smalsam-newr I'm redacting the codepath from the iOS app that this crash is stemming from, but there really isn't anything of note that you'd use from it, it's just the codepath from the codebase that is plugging into the New Relic SDK. There's 2 different stack traces that are recurring:

Screenshot 2024-08-30 at 14 48 27

Screenshot 2024-08-30 at 14 49 53

asos-callumtrounce commented 1 week ago

Hi @smalsam-newr / @cdillard-NewRelic , just a quick bump on this - are you able to confirm whether the above logs are sufficient please?

Do you know if a version including a fix will be available soon?

NicolasEymael commented 1 week ago

@asos-chrisblackmore our stacktrace is just a little bit different, but it is very similar this is the stacktrace of the most frequent crash related to NewRelic

Thread 0 Crashed:
0   CoreFoundation                   0x000000019da34f20 __exceptionPreprocess (CoreFoundation)
1   libobjc.A.dylib                  0x00000001958db2b8 objc_exception_throw (libobjc.A.dylib)
2   CoreFoundation                   0x000000019db3320c -[__NSSingleObjectEnumerator init] (CoreFoundation)
3   CoreFoundation                   0x000000019da3e044 -[NSMutableDictionary addEntriesFromDictionary:] (CoreFoundation)
4   NewRelic                         0x00000001062c6cc8 -[NRMASAM sessionAttributeJSONString] (NRMASAM.mm:201)
5   NewRelic                         0x00000001062bde50 -[NRMAHandledExceptions getSessionAttributesResultMap] (NRMAHandledExceptions.mm:0)
6   NewRelic                         0x00000001062bbe58 -[NRMAHandledExceptions recordError:attributes:] (NRMAHandledExceptions.mm:0)
7   NewRelic                         0x000000010626a7b0 +[NewRelic recordError:attributes:] (NewRelic.m:219)

but there are other crashes related to NewRelic with different stacktraces... ex1:

Thread 10 Crashed:
0   libsystem_kernel.dylib           0x00000001dfdfb42c __pthread_kill (libsystem_kernel.dylib)
1   libsystem_c.dylib                0x000000019ec9eba0 abort (libsystem_c.dylib)
2   libsystem_malloc.dylib           0x00000001a6edc588 malloc_vreport (libsystem_malloc.dylib)
3   libsystem_malloc.dylib           0x00000001a6ed9430 malloc_zone_error (libsystem_malloc.dylib)
4   libsystem_malloc.dylib           0x00000001a6ed4fd4 _szone_free (libsystem_malloc.dylib)
5   CoreFoundation                   0x0000000196cc54ec __CFStringDeallocate (CoreFoundation)
6   CoreFoundation                   0x0000000196cc4888 _CFRelease (CoreFoundation)
7   CoreFoundation                   0x0000000196cc4730 cow_cleanup (CoreFoundation)
8   CoreFoundation                   0x0000000196cc6c80 -[__NSDictionaryM dealloc] (CoreFoundation)
9   CoreFoundation                   0x0000000196d1a3d8 -[__NSDictionaryI dealloc] (CoreFoundation)
10  CoreFoundation                   0x0000000196cc4730 cow_cleanup (CoreFoundation)
11  CoreFoundation                   0x0000000196d0800c -[__NSFrozenDictionaryM dealloc] (CoreFoundation)
12  CoreFoundation                   0x0000000196cc6b68 __RELEASE_OBJECTS_IN_THE_ARRAY__ (CoreFoundation)
13  CoreFoundation                   0x0000000196cc6aa4 -[__NSArrayM dealloc] (CoreFoundation)
14  NewRelic                         0x00000001036aaef0 -[NRMAEventManager getEventJSONStringWithError:clearEvents:] (NRMAEventManager.m:0)
15  NewRelic                         0x0000000103697c90 -[NRMAAnalytics analyticsJSONString] (NRMAAnalytics.mm:1014)
16  NewRelic                         0x000000010369907c -[NRMAAnalytics handleHarvest] (NRMAAnalytics.mm:1186)
17  NewRelic                         0x0000000103685cb0 -[NRMAHarvester fireOnHarvestBefore] (NRMAHarvester.mm:647)
18  NewRelic                         0x0000000103685b00 -[NRMAHarvester execute] (NRMAHarvester.mm:614)
19  NewRelic                         0x000000010367b9a4 __54-[NewRelicAgentInternal applicationDidEnterBackground]_block_invoke_2 (NewRelicAgentInternal.m:817)

ex2:

Thread 16 Crashed:
0   CoreFoundation                   0x000000019baa4f20 __exceptionPreprocess (CoreFoundation)
1   libobjc.A.dylib                  0x000000019392f2b8 objc_exception_throw (libobjc.A.dylib)
2   CoreFoundation                   0x000000019bbae480 +[NSObject(NSObject) _copyDescription] (CoreFoundation)
3   CoreFoundation                   0x000000019ba41fb4 ___forwarding___ (CoreFoundation)
4   CoreFoundation                   0x000000019ba418d0 _CF_forwarding_prep_0 (CoreFoundation)
5   NewRelic                         0x0000000105281e50 -[NRMAHandledExceptions getSessionAttributesResultMap] (NRMAHandledExceptions.mm:0)
6   NewRelic                         0x000000010527fe58 -[NRMAHandledExceptions recordError:attributes:] (NRMAHandledExceptions.mm:0)
7   NewRelic                         0x000000010522e7b0 +[NewRelic recordError:attributes:] (NewRelic.m:219)

ex3:

Thread 23 Crashed:
0   libobjc.A.dylib                  0x000000018ee66064 objc_retain_x0 (libobjc.A.dylib)
1   NewRelic                         0x0000000107bd8964 +[NRMAHTTPUtilities startTrip] (NRMAHTTPUtilities.mm:0)
2   NewRelic                         0x0000000107bd80bc +[NRMAHTTPUtilities addConnectivityHeaderNRMAPayload:] (NRMAHTTPUtilities.mm:96)
3   NewRelic                         0x0000000107ba5f48 NRMAOverride__dataTaskWithRequest (NRMAURLSessionOverride.m:222)

ex5:

Thread 9 Crashed:
0   libobjc.A.dylib                  0x000000018e6efc20 objc_msgSend (libobjc.A.dylib)
1   NewRelic                         0x00000001056fcc04 -[NRMAHarvestableMetric JSONObject] (NRMAHarvestableMetric.m:124)
2   NewRelic                         0x00000001056c020c -[NRMAMetricSet JSONObject] (NRMAMetricSet.m:137)
3   NewRelic                         0x00000001056e2014 -[NRMAHarvestData JSONObject] (NRMAHarvestData.m:46)
4   NewRelic                         0x00000001056f84c8 +[NRMAJSON dataWithJSONABLEObject:options:error:] (NRMAJSON.m:26)
5   NewRelic                         0x0000000105721760 -[NRMAHarvesterConnection sendData:] (NRMAHarvesterConnection.m:213)
6   NewRelic                         0x00000001056efdc0 -[NRMAHarvester connected] (NRMAHarvester.mm:307)
7   NewRelic                         0x00000001056f1b10 -[NRMAHarvester execute] (NRMAHarvester.mm:615)
8   NewRelic                         0x00000001056e79a4 __54-[NewRelicAgentInternal applicationDidEnterBackground]_block_invoke_2 (NewRelicAgentInternal.m:817)
apadmi-thomas commented 4 days ago

We are also encountering the same problem in New Relic with 7.5.0 @smalsam-newr / @cdillard-NewRelic can you confirm ETA for fix?

cdillard-NewRelic commented 4 days ago

Thank you for providing those crash stacks. We can confirm we have reproduced and fixed ex0 and ex2. This fixes will be included in our next release. The other examples (ex1, ex3, ex5) we will investigate the tickets which we've added to our JIRA system. Please reach out to support and create a case containing more details. Thanks!

apadmi-thomas commented 4 days ago

Thank you for providing those crash stacks. We can confirm we have reproduced and fixed ex0 and ex2. This fixes will be included in our next release. The other examples (ex1, ex3, ex5) we will investigate the tickets which we've added to our JIRA system. Please reach out to support and create a case containing more details. Thanks!

Ticket raised with crash logs. Thanks!

asos-callumtrounce commented 3 days ago

Thanks so much @cdillard-NewRelic! Is there an ETA for the release that includes the crash fix?