Firebase-ios-sdk: SDK 7.5.0 crash when client calls iOS Vision framework

Created on 28 Jan 2021  路  15Comments  路  Source: firebase/firebase-ios-sdk

Step 1: Describe your environment

  • Xcode version: 12.4
  • Firebase SDK version: 7.5.0
  • Installation method: CocoaPods
  • Firebase Component: Crashlytics

Step 2: Describe the problem

SDK crashes when attempting to calculate saliency using iOS Vision framework calling VNGenerateAttentionBasedSaliencyImageRequest(). The issue is not present in Firebase SDK 7.4.0.

Screen Shot 2021-01-28 at 2 22 53 PM
Screen Shot 2021-01-28 at 2 12 25 PM
Screen Shot 2021-01-28 at 2 17 42 PM

Steps to reproduce:

The crash happens whenever the client tries to calculate saliency. It happens on any image 100% of the time. Removing the call to VNGenerateAttentionBasedSaliencyImageRequest() or switching to Firebase SDK 7.4.0 avoids the issue and Firebase SDK no longer crashes.

crashlytics needs-attention

All 15 comments

Hey @hingarn, apologies for this. We're looking into the issue but for now please downgrade to 7.4.0.

Hey @hingarn - I wasn't able to reproduce this. I was wondering if you could tell me a little more about your setup, in particular:

  • When do you call the Vision API that crashes Crashlytics? (eg. right at startup, after a button click?)
  • Do you call dlopen in your codebase?
  • Are you able to reproduce this on a device?

Any other information that's specific to your environment would be hugely appreciated.

Hey @samedson, here is the info.

  • I call Vision API when there is an image in the viewport, so after the app is fully loaded and the initial UI is rendered. If there are no images initially, the app doesn't crash. Then, once I scroll in an image, it crashes
  • I do not call dlopen. The call is present in Facebook SDK in the app, but it is not executed
  • It does not crash on a device

Our environment is straightforward. We do not do any custom setup. We do use Shake SDK for bug reporting, which does method swizzling.

Please let me know if I can provide you any additional details about the setup.

The same happens since 7.5.0 on my M1 machine, also only in simulator. Using Xcode Version 12.4 (12D4e)

image

If it helps, I am seeing the same issue but am not using the Vision framework in my app. I'm using Core Image. I'm getting this crash upon initializing a CIContext.

Screen Shot 2021-02-02 at 9 30 40 AM
Screen Shot 2021-02-02 at 9 29 11 AM

My reproduction case still isn't crashing on an M1 machine, so here's the quickstart project that I'm using to try and reproduce the issue with calls to the Vision API. Would someone here be able to try out this project and see if it reproduces the behavior on their machine, or tweak it such that it does?

Xcode Project Quickstart using the Vision API

It seems like common factors are:

  • Xcode 12.4
  • Simulator on Apple Silicon Mac

I am seeing this issue on a non-Apple Silicon Mac, in the simulator. I鈥檒l give that sample project a try and see if I can reproduce it.

@samedson created a PR that reproduces the issue for me: https://github.com/samedson/issues/pull/1

I am seeing this issue as well. The machine is an iMac Pro (10.15.7), running my iOS app in the Simulator (Xcode 12.2). We are using version 7.5.0 of the SDK. The crash happens on startup of the application:
Screen Shot 2021-02-03 at 11 08 10 a

I should be clear the only framework we're using in our application is Crashlytics (and any dependencies it may be using.)

Thank you @chrisvasselli for the repro case 馃憤 and everyone for the info. Somehow it still doesn't crash for me, but I believe we know what the bug is. Going to update to the newest macOS to see if that's the issue because I believe everything else with my environment matches reports here. It's likely a race condition based on the code.

We're going to post a change later today that should fix this issue, while still keeping the startup performance zippy (which was the initial reason for the change in 7.5.0 that caused this bug).

Could folks try out the change once it comes out?

Hi all - here's the PR for the proposed fix:

7459

Update: we've pushed a change to the main branch. Please let us know if this helps!

I've updated to the latest version and don't see the crash anymore.

Great, I'm going to close this for now but feel free to reopen if this didn't resolve the problem.

Was this page helpful?
0 / 5 - 0 ratings