firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

Crash at FPRTraceBackgroundActivityTracker.m

Open ValentineVV opened this issue 11 months ago • 8 comments

Crash at FPRTraceBackgroundActivityTracker.m

Here is stacktrace

          Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x9748 objc_moveWeak + 196
1  CoreFoundation                 0x50a94 _CFXNotificationRegistrarAddObserver + 392
2  CoreFoundation                 0x4f864 CFXNotificationRegistrarAdd + 580
3  CoreFoundation                 0x4f040 _CFXNotificationRegisterObserver + 248
4  FirebasePerformance            0x1c9f4 __41-[FPRTraceBackgroundActivityTracker init]_block_invoke + 44 (FPRTraceBackgroundActivityTracker.m:44)
5  libdispatch.dylib              0x213c _dispatch_call_block_and_release + 32
6  libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
7  libdispatch.dylib              0x125a4 _dispatch_main_queue_drain + 988
8  libdispatch.dylib              0x121b8 _dispatch_main_queue_callback_4CF + 44
9  CoreFoundation                 0x56710 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
10 CoreFoundation                 0x53914 __CFRunLoopRun + 1996
11 CoreFoundation                 0x52cd8 CFRunLoopRunSpecific + 608
12 GraphicsServices               0x11a8 GSEventRunModal + 164
13 UIKitCore                      0x40a90c -[UIApplication _run] + 888
14 UIKitCore                      0x4be9d0 UIApplicationMain + 340
15 App                          0x844f4 main + 36 (KAAppDelegate.swift:36)
16 ???                            0x1c3b51e4c (Missing)

Reproducing the issue

We don't know a 100% way to reproduce it, but looks like the crash happens when user moves app to background and then back to the foreground

Firebase SDK Version

11.6.0

Xcode Version

16.1

Installation Method

CocoaPods

Firebase Product(s)

Performance, Crashlytics, Remote Config, Analytics

Targeted Platforms

iOS

Relevant Log Output


If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet

Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

Replace this line with the contents of your Podfile.lock!

ValentineVV avatar Dec 19 '24 09:12 ValentineVV

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Dec 19 '24 09:12 google-oss-bot

I am unable to reproduce this issue, is there any more information you can give?

MichaelVerdon avatar Jan 07 '25 13:01 MichaelVerdon

@MichaelVerdon I have investigated the analytics and most of the time the crash happens when user moves app to the background and then returns it to the foreground or during the first app launch. But sometimes it happens randomly, so I hope this information will help you

ValentineVV avatar Jan 08 '25 07:01 ValentineVV

Thanks for your response, when I failed to reproduce the issue I had ran a bunch of simulations but I was using the latest IOS version, is this issue happening on a particular IOS version like an older one?

MichaelVerdon avatar Jan 08 '25 14:01 MichaelVerdon

@MichaelVerdon not really, it reproducible for any of these versions: 17.4.1, 18.1.1, 18.0.1, 17.4.0, 17.6.1, 16.6.0 and others. There is no specific version to reproduce it.

I also found a little bit more verbose stacktrace, I hope that it could help you somehow

          Crashed: org.alamofire.session.rootQueue
0  libobjc.A.dylib                0xfda8 objc_moveWeak + 196
1  CoreFoundation                 0x554c4 _CFXNotificationRegistrarAddObserver + 392
2  CoreFoundation                 0x54f0c CFXNotificationRegistrarAdd + 580
3  CoreFoundation                 0x54880 _CFXNotificationRegisterObserver + 248
4  FirebasePerformance            0x1c7b8 -[FPRTraceBackgroundActivityTracker init] + 44 (FPRTraceBackgroundActivityTracker.m:44)
5  FirebasePerformance            0x11bf4 -[FPRNetworkTrace start] + 198 (FPRNetworkTrace.m:198)
6  FirebasePerformance            0x17a68 __InstrumentDataTaskWithRequest_block_invoke + 276 (FPRNSURLSessionInstrument.m:276)
7  Alamofire                      0x2d82c DataStreamRequest.task(for:using:) + 122 (DataRequest.swift:122)
8  Alamofire                      0xbc690 Session.didCreateURLRequest(_:for:) + 1188 (Session.swift:1188)
9  Alamofire                      0xca120 partial apply for closure #3 in Session.performSetupOperations(for:convertible:shouldCreateTask:) + 72
10 Alamofire                      0x88dc4 thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:28)
11 libdispatch.dylib              0x213c _dispatch_call_block_and_release + 32
12 libdispatch.dylib              0x3dd4 _dispatch_client_callout + 20
13 libdispatch.dylib              0xb400 _dispatch_lane_serial_drain + 748
14 libdispatch.dylib              0xbf64 _dispatch_lane_invoke + 432
15 libdispatch.dylib              0xb284 _dispatch_lane_serial_drain + 368
16 libdispatch.dylib              0xbf30 _dispatch_lane_invoke + 380
17 libdispatch.dylib              0x16cb4 _dispatch_root_queue_drain_deferred_wlh + 288
18 libdispatch.dylib              0x16528 _dispatch_workloop_worker_thread + 404
19 libsystem_pthread.dylib        0x1f20 _pthread_wqthread + 288
20 libsystem_pthread.dylib        0x1fc0 start_wqthread + 8

ValentineVV avatar Jan 08 '25 16:01 ValentineVV

Also, here is the link to the previous issue that has been fixed in 11.6.0. Probably, that fix may be connected to the new issues that I created.

ValentineVV avatar Jan 08 '25 16:01 ValentineVV

Thanks for more logs, I have still been unable to recreate the issue, you could tediously go through every dependency and see which could be the culprit but I heavily suspect AlamoFire might be heavily involved. After running more tests with AlamoFire, I have yet to get a crash, especially moving back to background and foreground. Would you be able to give me a repository to look at and investigate?

MichaelVerdon avatar Jan 13 '25 16:01 MichaelVerdon

@MichaelVerdon Unfortunately I couldn't give you the access to the repository =(

ValentineVV avatar Jan 13 '25 16:01 ValentineVV

Same problem with same stack trace. Any idea how to fix?

pnzr00t avatar Mar 14 '25 07:03 pnzr00t

@visumickey

JesusRojass avatar Sep 17 '25 18:09 JesusRojass

Hello everyone

Doing research into this and I will have a fix soon (hopefully!) 😸

JesusRojass avatar Sep 17 '25 19:09 JesusRojass

@JesusRojass any update on this issue? It is causing a large number of crashes in our app.

clayjonezie avatar Oct 02 '25 16:10 clayjonezie

@clayjonezie Hello there

yes actually! I am gearing up to push a fix for this this week, though I would absolutely love if you could share some stack traces so I can take a quick look and see if I'm not missing anything

JesusRojass avatar Oct 02 '25 16:10 JesusRojass

Hello everyone

I am extremly sorry for the delay on this but I am currently checking the fix and solution to this issue

Just running several tests to check for flakiness and edge cases but it is coming!

JesusRojass avatar Oct 03 '25 21:10 JesusRojass

Good morning or afternoon or evening ya'll I have pushed a PR that adresses this crash, just waiting on review

Happy Monday and Happy Coding 🤓

JesusRojass avatar Oct 06 '25 13:10 JesusRojass

Hello hello there

The fix has been made and it's been merged This issue should now be addressed

If anything you know you can reach me and I will gladly help!

Thank you all for the patience and information!

Keep on keeping on!

JesusRojass avatar Oct 07 '25 23:10 JesusRojass