-
-
Notifications
You must be signed in to change notification settings - Fork 647
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
iOS: Many crashes due to lack of thread-safety #1696
Comments
I have those crashes too with
|
(also this should be labeled as bug I think) |
Can anyone look into this issue? Causing crash on production. |
I believe we may be having issues related to this as well. We are seeing crashes on release builds which is preventing us from upgrading in production. This is occurring when fetching subscription products. The Apple Docs warn that the SKProductsRequestDelegate may not return on a specific thread so feels likely that lack of thread-safety is the issue here? Stack trace
|
Not sure but I think this: #1910 might have fixed some memory leaks related to this. If not, please reopen |
I don't think #1910 addressed the issue as this is to do with thread safety, not memory leaks. Keeping this re-opened for now. |
Due to the Google Play Billing Client depreciation we have to upgrade our in production use of react native iap (v6), but every attempt we run into serious crashes such as this one now. Can anyone confirm if upgrading to Version 7 (First version with Billing Client 4) is safe in production, or if there is a specific version that anyone is using successfully and do not see these crashes? |
For anyone else in this issue, we upgraded successfully to version 7. So version 7 does not have this issue, it was introduced in version 8 and that version should be avoided |
Please create a new ticket if this is still happening on 11.x.x. Also please use the new Bug report template. There's simply not enough information here to try to reproduce. I'll be happy to look at it. |
This issue is causing our company to move off this library, which is a real shame. Please let us know the path moving forward |
**Fixes:** #1696, #2372 Similar to #2518, this fixes race condition crashes on `validProducts` and `productsRequest` in `RNIapIos.swift` when using Store Kit 1. ## React Native IAP ### What was done: - **Created `ThreadSafe` class:** This now wraps `validProducts`. - **Created `LatestPromiseKeeper`:** - Maintains only the latest promise to fix racing conditions when multiple `productsRequest` are made in parallel. - Resolves only one promise at any given time (for `productsRequest`), eliminating the possibility of racing conditions or execution exceptions while storing the resolved data. - Discards older promises if more than one is made, returning a rejection for the discarded promises. ## IAPExample (iOS) - Fixed target iOS deployment being loaded from an undefined variable. It now fetches the project's target iOS from the Xcode project and applies it during pod install. - Updated GitHub Action to use Node.js 20. - Changed GitHub Action runner from M1 architecture to Intel-based macOS (fixes crash during build).
The recently published version 12.4.0 includes a fix for a racing condition in iOS with StoreKit 1. |
Version of react-native-iap
8.0.8
Version of react-native
0.67.4
Platforms you faced the error (IOS or Android or both?)
iOS
Expected behavior
No crashing
Actual behavior
Random crashes with stack trace like this:
Tested environment (Emulator? Real Device?)
Real device
Steps to reproduce the behavior
This is caused by non-thread-safe access to the dictionary
promisesByKey
. A serial queue was added to protect some of these accesses but not all. IMHO a better way to protect this is by addingdispatch
directly inside ofaddPromise
,resolvePromises
&rejectPromises
.The text was updated successfully, but these errors were encountered: