Commit Graph

6 Commits

Author SHA1 Message Date
Evan Bacon cca3c13d2d Fixed Deadlock
Running this in a detached expo app can sometimes deadlock from thread issues.
I've replaced `dispatch_sync(dispatch_get_main_queue(), ^{});`  with `RCTUnsafeExecuteOnMainQueueSync(^{});` to fix this.

I only hit the error in the `RNFirebaseStorage.m` but it seems like the `RNFirebaseAnalytics.m` and `RNFirebase.m` modules could also have this same issue.

`RCTUnsafeExecuteOnMainQueueSync` checks to see if the method is being executed on the main thread before trying to sync to the main thread. If you try to sync on the main thread whilst on the main thread, you hit a deadlock.

You can read more about it here: https://stackoverflow.com/questions/12379059/why-is-this-dispatch-sync-call-freezing?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

The only testing I did was in a seperate detached ExpoKit project. Running this function would cause the crash.
```js
await firebase
      .storage()
      .ref(uploadUri)
      .putFile(uri);
```
2018-06-08 14:44:48 -07:00
Chris Bianca 42e7fb2e5d [ios] Firebase iOS v5 support 2018-05-16 17:22:47 +01:00
Taxidermic 21dc57c70b remove @synthesize 2018-04-06 14:57:05 +03:00
Taxidermic 9c4deb541a fixes races bug in react-native > 0.52 2018-04-04 14:05:32 +03:00
Akshet Pandey d362b6acd0 UIApplication methods should only be called from the main thread 2017-09-15 17:10:29 -07:00
Chris Bianca 4a7a7574db [ios] Break modules into subfolders 2017-06-16 11:15:42 +01:00