kalnyc67 / analytics-issues

Automatically exported from code.google.com/p/analytics-issues
0 stars 0 forks source link

Crashes due to overreleased object in GAIBatchingDispatcher #603

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
---------------------------------------------------------------------------
NOTE: This issue tracking system is for Google Analytics developer products
only.
If you are not a developer/programmer visit:
http://www.google.com/analytics/support.html
---------------------------------------------------------------------------
Name of affected component: Mobile Tracking

Name of related library and version, if applicable (e.g. Android, iOS,
Snippets, etc.): iOS, SDK v3.10

Issue summary:
There is an overreleased NSString/CFString somewhere in the event dispatching 
code of Google Analytics iOS SDK v3.10. I have seen over 5000 crashes in 14 
days from this cause alone since my app launched. Using Xcode Instruments, I 
have been able to find the overreleased object using the NSZombiesEnabled flag. 
I am using custom events, and setting a custom action and label and building 
the events using GAIDictionaryBuilder. I am also using custom metrics and 
custom dimensions. According to Apple's Instruments tool, it is the custom 
event label NSString that is being overreleased somewhere in the depths of 
GAIBatchingDispatcher. I see the app sometimes crash because of this when 
events actually get sent - which I can make happen by sending my app to the 
background and then resuming it. I have attached a sample crash log. The crash 
occurs on all device models on iOS 7 and later (which is what my app supports) 
- it does not appear to be device or OS specific.

Provide a brief summary of the issue you're experiencing.

Steps to reproduce issue:
1. Use the iOS SDK to report custom events with custom labels
2. Some portion of your custom label NSStrings will be overreleased by the SDK
3. Sometimes when the autorelease pool drains, or when the events are 
dispatched, you will see a SIGSEGV crash in objc_msgSend(). Profiling in Xcode 
Instruments, and looking at crash reports, reveals the Google Analytics SDK to 
be the source.

Expected output:
What do you expect to see after performing the above steps?
Custom event labels should not be overreleased.

Actual results:
What do you actually see after performing the above steps?
Custom event labels are sometimes being overreleased, leading to crashes.

Notes:
Provide any additional information which might be useful here. Feel free to
attach screenshots or sample code which demonstrates the issue being
described.

My project uses ARC. Custom labels affected this problem are being built like 
this, and are autoreleased objects:
[NSString stringWithFormat:@"%@ / level %@", packIDZeroPrefix, 
levelNumberZeroPrefix];

Producing strings like "Pack 1 / Level 20"

The events are being sent like this:

    [_tracker send:[[GAIDictionaryBuilder createEventWithCategory:aCategory
                                                           action:anEventAction
                                                            label:aLabel
                                                            value:value] build]];

Where aLabel is the string that I believe is being overreleased by the SDK.

Original issue reported on code.google.com by j...@littledetails.net on 3 Apr 2015 at 9:33

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by pfrise...@google.com on 20 Apr 2015 at 3:42