Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes on -[CountlyPersistency serializedRecordedEvents] #374

Open
agroelfe opened this issue Jan 27, 2025 · 3 comments
Open

Crashes on -[CountlyPersistency serializedRecordedEvents] #374

agroelfe opened this issue Jan 27, 2025 · 3 comments

Comments

@agroelfe
Copy link

Dear Countly Team!

I regret to report my app is having several crashes ending with similar crash logs:

Crash 1

libsystem_platform.dylib            0x000000022ada4afc 5079E5E0-3525-3D53-8FF0-3E297A22FC4F + 6908
CoreFoundation                      0x00000001a29e51b4 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 29108
CoreFoundation                      0x00000001a29e75cc 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 38348
CoreFoundation                      0x00000001a29e74b4 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 38068
CoreFoundation                      0x00000001a29e73f0 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 37872
MyModule                            -[CountlyPersistency serializedRecordedEvents]						countly-sdk-ios/CountlyPersistency.m:0
MyModule                            -[CountlyConnectionManager addEventsToQueue]						countly-sdk-ios/CountlyConnectionManager.m:479
MyModule                            -[CountlyConnectionManager sendEventsInternal]						countly-sdk-ios/CountlyConnectionManager.m:474
MyModule                            -[Countly onTimer:]													countly-sdk-ios/Countly.m:384
Foundation                          0x00000001a17a009c __NSFireTimer + 96
CoreFoundation                      0x00000001a2a92894 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 739476
CoreFoundation                      0x00000001a2a92538 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 738616
CoreFoundation                      0x00000001a2a9208c 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 737420
CoreFoundation                      0x00000001a2a313b4 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 340916
CoreFoundation                      0x00000001a2a30830 CFRunLoopRunSpecific + 588
GraphicsServices                    0x00000001eea101c4 GSEventRunModal + 164
UIKitCore                           0x00000001a5596eb0 575E5140-FA6A-37C2-B00B-A4EACEDFDA53 + 4009648
UIKitCore                           0x00000001a56455b4 UIApplicationMain + 340
MyApp                               0x000000010094f604 MyApp + 914948
dyld                                0x00000001c841eec8 3060D36A-16CE-3C3A-9258-3881459F5714 + 212680

Crash 2

libsystem_platform.dylib            0x000000022118cca8 1910C45F-008B-381A-925D-EC1EF100A669 + 19624
CoreFoundation                      0x00000001965cbde8 6A60BE13-E657-3BEC-A9AC-BA239AE29862 + 15848
CoreFoundation                      0x00000001965cdfdc 6A60BE13-E657-3BEC-A9AC-BA239AE29862 + 24540
CoreFoundation                      0x00000001965cded0 6A60BE13-E657-3BEC-A9AC-BA239AE29862 + 24272
CoreFoundation                      0x00000001965cde0c 6A60BE13-E657-3BEC-A9AC-BA239AE29862 + 24076
MyModule                            -[CountlyPersistency serializedRecordedEvents]                        countly-sdk-ios/CountlyPersistency.m:0  -[CountlyPersistency serializedRecordedEvents] + 456
MyModule                            -[CountlyConnectionManager addEventsToQueue]                          countly-sdk-ios/CountlyConnectionManager.m:479 + 52
MyModule                            -[CountlyConnectionManager sendEventsInternal]                        countly-sdk-ios/CountlyConnectionManager.m:474 + 20
MyModule                            -[Countly suspend]                                                    countly-sdk-ios/Countly.m:405 + 176
CoreFoundation                      0x0000000196616478 6A60BE13-E657-3BEC-A9AC-BA239AE29862 + 320632
CoreFoundation                      0x0000000196616394 6A60BE13-E657-3BEC-A9AC-BA239AE29862 + 320404
CoreFoundation                      0x0000000196614f08 6A60BE13-E657-3BEC-A9AC-BA239AE29862 + 315144
CoreFoundation                      0x000000019661400c _CFXNotificationPost + 728
Foundation                          0x000000019526c50c 7274DDE3-68D6-34A0-8E67-7726E1265E80 + 652556		
UIKitCore                           0x0000000199f43178 F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 18198904		
UIKitCore                           0x00000001991cdbd0 F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 4086736		
UIKitCore                           0x0000000199f42f58 F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 18198360		
UIKitCore                           0x00000001991d6a24 F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 4123172		
UIKitCore                           0x0000000199037680 _UIScenePerformActionsWithLifecycleActionMask + 112  
UIKitCore                           0x00000001991d7114 F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 4124948		
UIKitCore                           0x00000001991d6e24 F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 4124196		
UIKitCore                           0x0000000198f9d874 F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 1792116		
UIKitCore                           0x0000000198f9d594 F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 1791380		
UIKitCore                           0x0000000198f9d04c F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 1790028		
UIKitCore                           0x0000000198f9c1f4 F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 1786356		
UIKitCore                           0x0000000198f9b82c _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 224
UIKitCore                           0x0000000198f9b4dc F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 1783004
UIKitCore                           0x0000000199037430 F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 2421808
UIKitCore                           0x0000000199036d80 F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 2420096
UIKitCore                           0x000000019902e7a4 F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 2385828
UIKitCore                           0x000000019902df84 F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 2383748
FrontBoardServices                  0x00000001b00c4290 7822B4A1-AC20-3A78-9B0F-44EA1B6B6456 + 49808 
FrontBoardServices                  0x00000001b00c1834 7822B4A1-AC20-3A78-9B0F-44EA1B6B6456 + 38964 
FrontBoardServices                  0x00000001b00bf090 7822B4A1-AC20-3A78-9B0F-44EA1B6B6456 + 28816 
FrontBoardServices                  0x00000001b00d7868 7822B4A1-AC20-3A78-9B0F-44EA1B6B6456 + 129128
FrontBoardServices                  0x00000001b00d74c8 7822B4A1-AC20-3A78-9B0F-44EA1B6B6456 + 128200
FrontBoardServices                  0x00000001b00c2510 7822B4A1-AC20-3A78-9B0F-44EA1B6B6456 + 42256
libdispatch.dylib                   0x000000019e37bfa8 8CE3AFB9-6D84-3446-8FD4-E5F798D98403 + 16296
libdispatch.dylib                   0x000000019e37f9f0 8CE3AFB9-6D84-3446-8FD4-E5F798D98403 + 31216
FrontBoardServices                  0x00000001b00d0378 7822B4A1-AC20-3A78-9B0F-44EA1B6B6456 + 99192
FrontBoardServices                  0x00000001b00d02f8 7822B4A1-AC20-3A78-9B0F-44EA1B6B6456 + 99064
FrontBoardServices                  0x00000001b00d01d0 7822B4A1-AC20-3A78-9B0F-44EA1B6B6456 + 98768
CoreFoundation                      0x000000019663bf3c 6A60BE13-E657-3BEC-A9AC-BA239AE29862 + 474940
CoreFoundation                      0x000000019663bed0 6A60BE13-E657-3BEC-A9AC-BA239AE29862 + 474832
CoreFoundation                      0x000000019663eb30 6A60BE13-E657-3BEC-A9AC-BA239AE29862 + 486192
CoreFoundation                      0x000000019663dd2c 6A60BE13-E657-3BEC-A9AC-BA239AE29862 + 482604
CoreFoundation                      0x0000000196690274 CFRunLoopRunSpecific + 588
GraphicsServices                    0x00000001e38094c0 GSEventRunModal + 164
UIKitCore                           0x00000001991d677c F80C6EE4-50CA-346F-90EB-BB3DA9817503 + 4122492
UIKitCore                           0x0000000198dfce64 UIApplicationMain + 340
MyApp|??|??:0,                      0x00000001021e3604 MyApp + 914948
dyld                                0x00000001bc864de8 4EB7459F-E237-38CE-8240-3F3E2E1CE5AB + 196072

Crash 3

libsystem_platform.dylib            0x0000000217d10afc 5079E5E0-3525-3D53-8FF0-3E297A22FC4F + 6908 
CoreFoundation                      0x000000018f9591b4 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 29108
CoreFoundation                      0x000000018f95b5cc 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 38348
CoreFoundation                      0x000000018f95b4b4 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 38068
CoreFoundation                      0x000000018f95b3f0 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 37872
MyModule                            -[CountlyPersistency serializedRecordedEvents]                          countly-sdk-ios/CountlyPersistency.m:0
MyModule                            -[CountlyConnectionManager addEventsToQueue]                            countly-sdk-ios/CountlyConnectionManager.m:479
MyModule                            -[CountlyConnectionManager sendEventsInternal]                          countly-sdk-ios/CountlyConnectionManager.m:474
MyModule                            -[CountlyPersistency recordEvent:]                                      countly-sdk-ios/CountlyPersistency.m:278
MyModule                            -[Countly recordEvent:segmentation:count:sum:duration:ID:timestamp      countly-sdk-ios/Countly.m:932
MyModule                            -[Countly recordEvent:segmentation:count:sum:duration:]                 countly-sdk-ios/Countly.m:861
...

Environment

Countly versions: 24.7.9, 23.8.3
iOS Versions: 18.x, 17.x

Countly config:

         let config: CountlyConfig = CountlyConfig()
        config.appKey = ...
        config.host = ...
        config.secretSalt = ...
        config.alwaysUsePOST = true
        config.storedRequestsLimit = 10_000
        config.deviceID = "SOME_STRING_CONST"
        config.features = [.crashReporting]
        config.enableDebug = true
        let urlSessionConfig = URLSessionConfiguration.ephemeral
        var headers = urlSessionConfig.httpAdditionalHeaders ?? .init()
        headers["<SOME_HEADER>"] = "SOME_VALUE"
        urlSessionConfig.httpAdditionalHeaders = headers
        config.urlSessionConfiguration = urlSessionConfig
        Countly.sharedInstance().start(with: config)

A Device ID is changed to user-specific one in runtime via Countly.sharedInstance().changeDeviceID(withMerge:).

Can you, please, help me find a workaround for this or fix it?

@arifBurakDemiray
Copy link
Member

arifBurakDemiray commented Jan 27, 2025

Hello @agroelfe,

Thank you for reporting this issue. To investigate and resolve the crash effectively, I’d like to request the following:

Segmentation Details: Could you please clarify what segmentation data is being sent? Specifically, if there are custom fields or unexpected large payloads, this will help us identify any issues in the data being serialized.

Crash Reproduction: If possible, could you enable debugging in your app and attempt to reproduce the crash? This will allow us to pinpoint the root cause more effectively. And also too see the crash in details we need to see non-symbolicated stack trace.

To enable debugging in the SDK, please use the following configuration during initialization:
config.enableDebug = true

Plase share the logs captured from the moment the SDK is initialized until just after the crash. These logs will provide valuable context for understanding what happened prior to the error.

Once we have this information, we’ll be able to dive deeper into the issue and provide a resolution promptly.

Looking forward to your response. Let me know if there’s anything else I can do to assist!

@agroelfe
Copy link
Author

Hi, @arifBurakDemiray!

  1. BTW, I forgot to mention the crash reason is App terminated by SIGSEGV.

  2. As for my segmentation parameters, we only send small string dictionaries:

var params: [String: String] = ...
if let duration = event.duration {
    Countly.sharedInstance().recordEvent(event.key, segmentation: params, count: 1, sum: 0, duration: duration)
} else {
    Countly.sharedInstance().recordEvent(event.key, segmentation: params)
}

We do not exceed 10 parameters per event (I guess even 8), very most of them are short string values of swift enumerations in our codebase, with few exceptions having a URL in a String form.

  1. As for execution logs, unfortunately, I don't have them because I cannot reproduce this crash on my device. I only have a set of crash logs from my users. I'm trying to reproduce it, in case I get lucky - I'll share Countly debug logs with you.

@arifBurakDemiray
Copy link
Member

Hi @agroelfe,

Thank you for sharing the details about the crash and your usage patterns! I understand how tricky these issues can be, especially when they're hard to reproduce on your end.

I'll also dive deeper into this issue and attempt to reproduce the crash on my side. In the meantime, I'll review the crash logs you provided and investigate potential edge cases in the SDK that could lead to a SIGSEGV.

If you do manage to reproduce the crash and can share the Countly debug logs, it would help narrow down the root cause significantly. I'll keep you updated on my findings as I work through this.

Thanks for your patience, and let me know if there’s anything else I can assist with in the meantime!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants