j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.3k stars 537 forks source link

[ANDROID] [IOS] Race Condition causing Re-Validation Loop #1183

Open DominikTrenz opened 3 years ago

DominikTrenz commented 3 years ago

There seems to be a race condition when verifying the receipt with fovea/own validator. It looks like the product state bounces back from owned to approved state. In the log i can see that scheduleValidation gets called twice. One seems to successfully put the product in owned state but the other call gets delayed by 1500ms still holding a reference to the product in approved state which leads to an infinite loop that repeats every 1500ms. It has to do with these lines:

https://github.com/j3k0/cordova-plugin-purchase/blob/master/www/store-android.js#L739

https://github.com/j3k0/cordova-plugin-purchase/blob/master/www/store-android.js#L1785

It seems to be reproduceable when calling "store.refresh" with an already active auto renewing android subscriptions.

DominikTrenz commented 3 years ago

1136 could be connected

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.