Skip to content

Conversation

@wowlocal
Copy link
Contributor

This commit fixes a threading issue in the FIRCLSInstallIdentifierModel class that caused a 10-second hang during Crashlytics initialization in urgent mode. The issue was caused by a semaphore that was waiting for a completion handler to unblock it, but the completion handler was waiting for the main thread to call dispatch_async, resulting in a deadlock. To solve this problem, the code was updated to use a runloop spinning mechanism instead of the semaphore when running on the main thread. This allows dispatch_async to notify the thread to resume execution without blocking it.

Changes include:

  • Introducing a check for the main thread before using a semaphore
  • Using a run loop to handle main thread execution
  • Adding a test case for report preparation on the main thread
  • Adding a GoogleService-Info.plist file for support initialization of the FIRApp.defaultApp in the unit tests

…gent mode

This commit resolves a threading issue in the FIRCLSInstallIdentifierModel class that caused a 10-second hang during Crashlytics initialization in urgent mode. The issue was caused by a semaphore that was used in a main thread, which blocked the main thread's execution and prevented completion of the installation ID check within the designated time limit. To address this issue, the code was updated to check whether the current thread is the main thread, and if so, eliminate usage of the semaphore entirely. Instead, a runloop spinning mechanism was introduced, which allows dispatch_async to notify the thread to resume execution.
@samedson
Copy link
Contributor

samedson commented May 2, 2023

Hey @wowlocal, I made a change to this PR in a new one: https://github.com/firebase/firebase-ios-sdk/pull/11216/files. I put the rationale in the description.

I am for some reason unable to run your new test using Swift Package Manager. Are you able to run it?

@wowlocal
Copy link
Contributor Author

wowlocal commented May 2, 2023

Hey @wowlocal, I made a change to this PR in a new one: https://github.com/firebase/firebase-ios-sdk/pull/11216/files. I put the rationale in the description.

I am for some reason unable to run your new test using Swift Package Manager. Are you able to run it?

The resourcePath behaves differently when using SPM.
I have identified and tested a solution for this issue based on similar cases. firebase-ios-sdk.patch

@samedson
Copy link
Contributor

samedson commented Jun 9, 2023

Closing in favor of #11216

@samedson samedson closed this Jun 9, 2023
@firebase firebase locked and limited conversation to collaborators Jul 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants