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

High Frequency of random crashes due to Firebase sdk #12952

Closed
jack45j opened this issue May 13, 2024 · 2 comments
Closed

High Frequency of random crashes due to Firebase sdk #12952

jack45j opened this issue May 13, 2024 · 2 comments
Assignees

Comments

@jack45j
Copy link

jack45j commented May 13, 2024

Description

Since our app's release of a certain version update, there has been a huge amount of random crashes related to APM, such as:

  • APMPersistentDictionary stringForKey:
  • APMPBMeasurementBundle protoBuffer
  • APMScreenViewReporter viewControllerDidDisappear:
  • APMDatabase insertIfNotExistsRawEventMetadata:error:
  • APMPersistedConfig stringForKey: _block_invoke
  • APMEManager flagValueForFlagName:SDKName: _block_invoke
  • APMValue initWithString
    and so on.

Specifically, these crashes started appearing in large numbers after an update that introduced a new resetDatabase() method. This method is called on some users' devices and always after Firebase.configure(). Here is the method:

extension CoreDataMainContext {
    func resetDatabase() {
        self.managedObjectContext.perform {
            do {
                try self.stack.persistentStoreCoordinator.managedObjectModel.entities.forEach { entity in
                    if let name = entity.name {
                        let fetch = NSFetchRequest<NSFetchRequestResult>(entityName: name)
                        let request = NSBatchDeleteRequest(fetchRequest: fetch)
                        try self.managedObjectContext.execute(request)
                    }
                }
                try self.managedObjectContext.save()
            } catch {
                print("Reset database failure with error: \(error.localizedDescription)")
            }
        }
    }
}

In my understanding, this resetDatabase() should only affect a specific CoreDataStack. Even if Firebase also uses SQLite, it shouldn't be affected, right? I noticed issue #12796 mentioned a similar situation, but it seems there hasn't been a conclusion yet.

I'm attaching some related stack traces here. If you need any other information or if there's something I might have done wrong, please let me know. Thanks for all your hard work for the community, you guys are really doing a great job.

截圖 2024-05-13 下午3 24 56 截圖 2024-05-13 下午3 17 20 截圖 2024-05-13 下午3 17 26 截圖 2024-05-13 下午3 17 32

stacktrace.zip

Reproducing the issue

No response

Firebase SDK Version

10.22.1

Xcode Version

15.3

Installation Method

Swift Package Manager

Firebase Product(s)

Analytics, Crashlytics, DynamicLinks

Targeted Platforms

iOS

Relevant Log Output

No response

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

Expand Package.resolved snippet
{
  "object": {
    "pins": [
      {
        "package": "abseil",
        "repositoryURL": "https://github.com/google/abseil-cpp-binary.git",
        "state": {
          "branch": null,
          "revision": "bfc0b6f81adc06ce5121eb23f628473638d67c5c",
          "version": "1.2022062300.0"
        }
      },
      {
        "package": "AppCheck",
        "repositoryURL": "https://github.com/google/app-check.git",
        "state": {
          "branch": null,
          "revision": "3e464dad87dad2d29bb29a97836789bf0f8f67d2",
          "version": "10.18.1"
        }
      },
      {
        "package": "Charts",
        "repositoryURL": "https://github.com/danielgindi/Charts.git",
        "state": {
          "branch": null,
          "revision": "07b23476ad52b926be772f317d8f1d4511ee8d02",
          "version": "4.1.0"
        }
      },
      {
        "package": "Facebook",
        "repositoryURL": "https://github.com/facebook/facebook-ios-sdk",
        "state": {
          "branch": null,
          "revision": "e14f349945ba3f9516e3292107f42be19fe9fbe5",
          "version": "12.3.2"
        }
      },
      {
        "package": "Firebase",
        "repositoryURL": "https://github.com/firebase/firebase-ios-sdk.git",
        "state": {
          "branch": null,
          "revision": "be49849dcba96f2b5ee550d4eceb2c0fa27dade4",
          "version": "10.22.1"
        }
      },
      {
        "package": "FSPagerView",
        "repositoryURL": "https://github.com/olbartek/FSPagerView",
        "state": {
          "branch": null,
          "revision": "f07d67c1d0a19cadfb94014d4d9653ccdf25169d",
          "version": "0.8.3"
        }
      },
      {
        "package": "GoogleAppMeasurement",
        "repositoryURL": "https://github.com/google/GoogleAppMeasurement.git",
        "state": {
          "branch": null,
          "revision": "482cfa4e5880f0a29f66ecfd60c5a62af28bd1f0",
          "version": "10.22.1"
        }
      },
      {
        "package": "GoogleDataTransport",
        "repositoryURL": "https://github.com/google/GoogleDataTransport.git",
        "state": {
          "branch": null,
          "revision": "a732a4b47f59e4f725a2ea10f0c77e93a7131117",
          "version": "9.3.0"
        }
      },
      {
        "package": "GoogleUtilities",
        "repositoryURL": "https://github.com/google/GoogleUtilities.git",
        "state": {
          "branch": null,
          "revision": "bc27fad73504f3d4af235de451f02ee22586ebd3",
          "version": "7.12.1"
        }
      },
      {
        "package": "gRPC",
        "repositoryURL": "https://github.com/google/grpc-binary.git",
        "state": {
          "branch": null,
          "revision": "a673bc2937fbe886dd1f99c401b01b6d977a9c98",
          "version": "1.49.1"
        }
      },
      {
        "package": "GTMSessionFetcher",
        "repositoryURL": "https://github.com/google/gtm-session-fetcher.git",
        "state": {
          "branch": null,
          "revision": "76135c9f4e1ac85459d5fec61b6f76ac47ab3a4c",
          "version": "3.3.1"
        }
      },
      {
        "package": "InteropForGoogle",
        "repositoryURL": "https://github.com/google/interop-ios-for-google-sdks.git",
        "state": {
          "branch": null,
          "revision": "2d12673670417654f08f5f90fdd62926dc3a2648",
          "version": "100.0.0"
        }
      },
      {
        "package": "JWTDecode",
        "repositoryURL": "https://github.com/auth0/JWTDecode.swift",
        "state": {
          "branch": null,
          "revision": "58af7278797871e460d79496621b3e5366b865b2",
          "version": "3.1.0"
        }
      },
      {
        "package": "leveldb",
        "repositoryURL": "https://github.com/firebase/leveldb.git",
        "state": {
          "branch": null,
          "revision": "9d108e9112aa1d65ce508facf804674546116d9c",
          "version": "1.22.3"
        }
      },
      {
        "package": "LineSDK",
        "repositoryURL": "https://github.com/line/line-sdk-ios-swift",
        "state": {
          "branch": null,
          "revision": "ccfdf2c2e0bdebc303e24edf8978e09d768b1002",
          "version": "5.11.0"
        }
      },
      {
        "package": "MKRingProgressView",
        "repositoryURL": "https://github.com/maxkonovalov/MKRingProgressView",
        "state": {
          "branch": null,
          "revision": "660888aab1d2ab0ed7eb9eb53caec12af4955fa7",
          "version": "2.3.0"
        }
      },
      {
        "package": "nanopb",
        "repositoryURL": "https://github.com/firebase/nanopb.git",
        "state": {
          "branch": null,
          "revision": "819d0a2173aff699fb8c364b6fb906f7cdb1a692",
          "version": "2.30909.0"
        }
      },
      {
        "package": "Promises",
        "repositoryURL": "https://github.com/google/promises.git",
        "state": {
          "branch": null,
          "revision": "e70e889c0196c76d22759eb50d6a0270ca9f1d9e",
          "version": "2.3.1"
        }
      },
      {
        "package": "SDWebImage",
        "repositoryURL": "https://github.com/SDWebImage/SDWebImage",
        "state": {
          "branch": null,
          "revision": "b11493f76481dff17ac8f45274a6b698ba0d3af5",
          "version": "5.18.11"
        }
      },
      {
        "package": "swift-algorithms",
        "repositoryURL": "https://github.com/apple/swift-algorithms",
        "state": {
          "branch": null,
          "revision": "f6919dfc309e7f1b56224378b11e28bab5bccc42",
          "version": "1.2.0"
        }
      },
      {
        "package": "swift-numerics",
        "repositoryURL": "https://github.com/apple/swift-numerics.git",
        "state": {
          "branch": null,
          "revision": "0a5bc04095a675662cf24757cc0640aa2204253b",
          "version": "1.0.2"
        }
      },
      {
        "package": "SwiftProtobuf",
        "repositoryURL": "https://github.com/apple/swift-protobuf.git",
        "state": {
          "branch": null,
          "revision": "65e8f29b2d63c4e38e736b25c27b83e012159be8",
          "version": "1.25.2"
        }
      },
      {
        "package": "Swinject",
        "repositoryURL": "https://github.com/Swinject/Swinject",
        "state": {
          "branch": null,
          "revision": "8bc503e60965298984fb58cf47b71c541449fe2a",
          "version": "2.8.3"
        }
      }
    ]
  },
  "version": 1
}

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
@jack45j jack45j changed the title High Frequency of Crashes Related to APM After Recent Update High Frequency of Crashes Related to APM May 13, 2024
@jack45j jack45j changed the title High Frequency of Crashes Related to APM High Frequency of random crashes due to Firebase sdk May 13, 2024
@pcfba pcfba self-assigned this May 15, 2024
@pcfba
Copy link
Contributor

pcfba commented May 20, 2024

We're looking into this. A couple questions:

  1. In your stack traces, BBSCRUtility [CQyAouKZHVJpfDlh jnndIJCDUPkbiIxp] and store_shellcode() appear. What is BBSCRUtility?
  2. Are you able to reproduce this crash in your app or a sample project? If so, does removing the call to resetDatabase() remove the crash?

@jack45j
Copy link
Author

jack45j commented May 23, 2024

Sorry for the delayed response due to the crash issues we've been dealing with over the past couple of days.

Earlier today, we confirmed that these crashes, including the BBSCRUtility issue, were caused by an obfuscation tool provided by one of our suppliers. Over the past month, this supplier has consistently denied any issues with their tool, which is why we did not initially suspect or test it.

Most of the crash reports were related to APM, which is why I chose to open an issue here. After removing the obfuscation tool, the APM, store_shellcode, and BBSCRUtility issues have not reoccurred.

I apologize for any inconvenience and for taking up your time with this issue. I am also sorry for opening an issue here before thoroughly investigating the root cause on my end. 🙏

@jack45j jack45j closed this as completed May 23, 2024
@pcfba pcfba removed the needs-info label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants