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

Intermittent FirebaseCoreInternal: specialized RingBuffer.push(_:) + 380 crash #10025

Closed
kostiag opened this issue Jul 18, 2022 · 12 comments · Fixed by #10032
Closed

Intermittent FirebaseCoreInternal: specialized RingBuffer.push(_:) + 380 crash #10025

kostiag opened this issue Jul 18, 2022 · 12 comments · Fixed by #10032

Comments

@kostiag
Copy link

kostiag commented Jul 18, 2022

Step 0: Are you in the right place?
For issues or feature requests related to the code in this repository
file a GitHub issue.
If this is a feature request please use the Feature Request template.
For general technical questions, post a question on StackOverflow
with the firebase tag.
For general (non-iOS) Firebase discussion, use the firebase-talk
google group.
For backend issues, console issues, and other non-SDK help that does not fall under one
of the above categories, reach out to
Firebase Support.
Once you've read this section and determined that your issue is appropriate for
this repository, please delete this section.
[REQUIRED] Step 1: Describe your environment
Xcode 13.4.1
it could be an actual device or simulator, different iPad versions. iOS:
15.3.0
15.5.0
15.4.1
15.2

Firebase/Analytics (9.2.0):
Firebase/Core
Firebase/Core (9.2.0):
Firebase/CoreOnly
FirebaseAnalytics (~> 9.2.0)
Firebase/CoreOnly (9.2.0):
FirebaseCore (= 9.2.0)
Firebase/Crashlytics (9.2.0):
Firebase/CoreOnly
FirebaseCrashlytics (~> 9.2.0)
Firebase/Performance (9.2.0):
Firebase/CoreOnly
FirebasePerformance (~> 9.2.0)
FirebaseABTesting (9.3.0):
FirebaseCore (~> 9.0)
FirebaseAnalytics (9.2.0):
FirebaseAnalytics/AdIdSupport (= 9.2.0)
FirebaseCore (~> 9.0)
FirebaseInstallations (~> 9.0)
GoogleUtilities/AppDelegateSwizzler (~> 7.7)
GoogleUtilities/MethodSwizzler (~> 7.7)
GoogleUtilities/Network (~> 7.7)
"GoogleUtilities/NSData+zlib (~> 7.7)"
nanopb (< 2.30910.0, >= 2.30908.0)
FirebaseAnalytics/AdIdSupport (9.2.0):
FirebaseCore (~> 9.0)
FirebaseInstallations (~> 9.0)
GoogleAppMeasurement (= 9.2.0)
GoogleUtilities/AppDelegateSwizzler (~> 7.7)
GoogleUtilities/MethodSwizzler (~> 7.7)
GoogleUtilities/Network (~> 7.7)
"GoogleUtilities/NSData+zlib (~> 7.7)"
nanopb (< 2.30910.0, >= 2.30908.0)
FirebaseCore (9.2.0):
FirebaseCoreDiagnostics (~> 9.0)
FirebaseCoreInternal (~> 9.0)
GoogleUtilities/Environment (~> 7.7)
GoogleUtilities/Logger (~> 7.7)
FirebaseCoreDiagnostics (9.3.0):
GoogleDataTransport (< 10.0.0, >= 9.1.4)
GoogleUtilities/Environment (~> 7.7)
GoogleUtilities/Logger (~> 7.7)
nanopb (< 2.30910.0, >= 2.30908.0)
FirebaseCoreInternal (9.3.0):
"GoogleUtilities/NSData+zlib (~> 7.7)"
FirebaseCrashlytics (9.2.0):
FirebaseCore (~> 9.0)
FirebaseInstallations (~> 9.0)
GoogleDataTransport (< 10.0.0, >= 9.1.4)
GoogleUtilities/Environment (~> 7.7)
nanopb (< 2.30910.0, >= 2.30908.0)
PromisesObjC (~> 2.1)
FirebaseInstallations (9.3.0):
FirebaseCore (~> 9.0)
GoogleUtilities/Environment (~> 7.7)
GoogleUtilities/UserDefaults (~> 7.7)
PromisesObjC (~> 2.1)
FirebasePerformance (9.2.0):
FirebaseCore (~> 9.0)
FirebaseInstallations (~> 9.0)
FirebaseRemoteConfig (~> 9.0)
GoogleDataTransport (< 10.0.0, >= 9.1.4)
GoogleUtilities/Environment (~> 7.7)
GoogleUtilities/ISASwizzler (~> 7.7)
GoogleUtilities/MethodSwizzler (~> 7.7)
nanopb (< 2.30910.0, >= 2.30908.0)
FirebaseRemoteConfig (9.3.0):
FirebaseABTesting (~> 9.0)
FirebaseCore (~> 9.0)
FirebaseInstallations (~> 9.0)
GoogleUtilities/Environment (~> 7.7)
"GoogleUtilities/NSData+zlib (~> 7.7)"
GoogleAppMeasurement (9.2.0):
GoogleAppMeasurement/AdIdSupport (= 9.2.0)
GoogleUtilities/AppDelegateSwizzler (~> 7.7)
GoogleUtilities/MethodSwizzler (~> 7.7)
GoogleUtilities/Network (~> 7.7)
"GoogleUtilities/NSData+zlib (~> 7.7)"
nanopb (< 2.30910.0, >= 2.30908.0)
GoogleAppMeasurement/AdIdSupport (9.2.0):
GoogleAppMeasurement/WithoutAdIdSupport (= 9.2.0)
GoogleUtilities/AppDelegateSwizzler (~> 7.7)
GoogleUtilities/MethodSwizzler (~> 7.7)
GoogleUtilities/Network (~> 7.7)
"GoogleUtilities/NSData+zlib (~> 7.7)"
nanopb (< 2.30910.0, >= 2.30908.0)
GoogleAppMeasurement/WithoutAdIdSupport (9.2.0):
GoogleUtilities/AppDelegateSwizzler (~> 7.7)
GoogleUtilities/MethodSwizzler (~> 7.7)
GoogleUtilities/Network (~> 7.7)
"GoogleUtilities/NSData+zlib (~> 7.7)"
nanopb (< 2.30910.0, >= 2.30908.0)
GoogleDataTransport (9.1.4):
GoogleUtilities/Environment (~> 7.7)
nanopb (< 2.30910.0, >= 2.30908.0)
PromisesObjC (< 3.0, >= 1.2)
GoogleUtilities/AppDelegateSwizzler (7.7.0):
GoogleUtilities/Environment
GoogleUtilities/Logger
GoogleUtilities/Network
GoogleUtilities/Environment (7.7.0):
PromisesObjC (< 3.0, >= 1.2)
GoogleUtilities/ISASwizzler (7.7.0)
GoogleUtilities/Logger (7.7.0):
GoogleUtilities/Environment
GoogleUtilities/MethodSwizzler (7.7.0):
GoogleUtilities/Logger
GoogleUtilities/Network (7.7.0):
GoogleUtilities/Logger
"GoogleUtilities/NSData+zlib"
GoogleUtilities/Reachability
"GoogleUtilities/NSData+zlib (7.7.0)"
GoogleUtilities/Reachability (7.7.0):
GoogleUtilities/Logger
GoogleUtilities/UserDefaults (7.7.0):
GoogleUtilities/Logger

[REQUIRED] Step 2: Describe the problem
Intermittent crashes during app restart.

Crashed: com.heartbeat.storage.1:476032081912:ios:a071534fa95fd5d5a4800d
EXC_BREAKPOINT 0x0000000101bff76c
0
FirebaseCoreInternal
- Line 380
specialized RingBuffer.push(:) + 380
1
FirebaseCoreInternal
HeartbeatsBundle.swift - Line 61
HeartbeatsBundle.append(:) + 61
2
FirebaseCoreInternal
HeartbeatController.swift - Line 82
closure https://github.com/firebase/firebase-ios-sdk/pull/1 in HeartbeatController.log(_:) + 82
3
FirebaseCoreInternal
HeartbeatStorage.swift - Line 110
closure https://github.com/firebase/firebase-ios-sdk/pull/1 in HeartbeatStorage.readAndWriteAsync(using:) + 110
4
FirebaseCoreInternal
- Line 28
thunk for https://github.com/escaping @callee_guaranteed () -> () + 28

Steps to reproduce:
What happened? How can we make the problem occur?
This could be a description, log/console output, etc.

If you have a downloadable sample project that reproduces the bug you're reporting, you will
likely receive a faster response on your issue.

Relevant Code:
Screen Shot 2022-07-18 at 9 00 06 AM
Screen Shot 2022-07-18 at 9 00 12 AM
Screen Shot 2022-07-18 at 9 00 20 AM

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.
@morganchen12
Copy link
Contributor

EXC_BREAKPOINT is usually indicative of a Swift assertion failure. Based on the stack trace, it's coming from this method.

There's no force-unwraps in this method, so the only assertion failures possible that I know of are integer overflow (unlikely) and out-of-bounds array access.

@ncooke3
Copy link
Member

ncooke3 commented Jul 20, 2022

Hi @kostiag, I have a few questions to help my investigation.

  1. Do you configure more than one Firebase app in your project?
  2. Is the attached crash report suggesting that the RingBuffer.push(_:) API is being called from two different threads OR is each row in your screenshot an independent crash?

Thanks!

@kostiag
Copy link
Author

kostiag commented Jul 20, 2022

Hi,

  1. only 1 app in the project.
  2. independent crashes
@ncooke3
Copy link
Member

ncooke3 commented Jul 20, 2022

Thanks @kostiag, and what Firebase products do you use in your app?

And, are you able to provide any more detail with regard to the captured stack traces? (No worries if the screenshot is all the information we have to work with.)

@kostiag
Copy link
Author

kostiag commented Jul 20, 2022

Unfortunately not, I believe this is happening on the start-up of the application, and once this is happens there is no way to get passed this crash.

@kostiag
Copy link
Author

kostiag commented Jul 20, 2022

happens in the field so I can't really help much but what data could I collect in case I can reproduce it while debugging locally?

@ncooke3
Copy link
Member

ncooke3 commented Jul 20, 2022

Unfortunately not, I believe this is happening on the start-up of the application, and once this is happens there is no way to get passed this crash.

Yep, this makes sense given the issue. I'm not yet able to understand why it's getting to this invalid state.

happens in the field so I can't really help much but what data could I collect in case I can reproduce it while debugging locally?

Basically any context regarding what state the app was in (i.e. first open after install, etc).

And question, what tool are you viewing your crash reports in?

@kostiag
Copy link
Author

kostiag commented Jul 21, 2022 via email

@ncooke3
Copy link
Member

ncooke3 commented Jul 21, 2022

Thanks @kostiag, I would be curious if opening the crash in Xcode provides any more information regarding the context the app was in. Additionally, running Xcode's TSAN tool during your app's startup may reveal some weirder concurrency related issues at play.

Anyhow, sorry again for the trouble... I'm working on #10032 to help prevent this issue.

@kostiag
Copy link
Author

kostiag commented Jul 21, 2022 via email

@ncooke3
Copy link
Member

ncooke3 commented Jul 22, 2022

Hi @kostiag, I've merged a fix for this issue. It is expected to release the week of August 2 in Firebase 9.4.0.

I've marked the issue as closed, but please report back if you see the crashes reappearing when shipping your app with Firebase 9.4.0.

@morganchen12 morganchen12 added this to the 9.4.0 - M119 milestone Jul 25, 2022
@firebase firebase locked and limited conversation to collaborators Aug 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
4 participants