Skip to content

App Hang in PostReceiptDataOperation #2198

Description

@swrobel

Creating a new issue per @NachoSoto

Describe the bug
I have a React Native app that uses the react-native-purchases library, which I understand depends on this one. One of our testers is seeing frequent app hangs & terminations that all seem to indicate an error with PostReceiptDataOperation. My theory is that this tester has "purchased" our subscription so many times creating test accounts that there is a large volume of transactions to be downloaded that is hanging the app. It's worth noting that this is still happening even after I created a test build that removes all explicit calls to getCustomerInfo(), so this seems to be called when all I'm doing is setting up RevenueCat at app initialization, but not even making any explicit API calls. Removing all RevenueCat code & dependencies from my app prevents the hangs & associated crashes for this tester.

@NachoSoto has proposed that this is a string interpolation issue related to bad data from javascript. I use Purchases.logIn(user.id) from react-native-purchases and my user ids are UUIDs, ex: 4f5d5640-264d-4da2-82ea-ab4d6264f7bc. Or maybe appUserId is something else? I know that the React Native setup instructions don't mention it, though other SDK setup instructions (ie: Swift) do...

  1. Environment
    1. Platform: iOS
    2. SDK versions:
      • react-native: 0.70.6
      • react-native-purchases: 5.4.0
      • PurchasesHybridCommon pod: 4.5.4
      • RevenueCat pod: 4.15.5
    3. StoreKit 2 (disabled with useStoreKit2IfEnabled(false)) (Y/N): N
    4. OS version: 16.1.1
    5. Xcode version: 14
    6. How widespread is the issue. Percentage of devices affected.
  2. Debug logs that reproduce the issue - I can't provide these since it only occurs on a Testflight user's real device
  3. Steps to reproduce, with a description of expected vs. actual behavior
  4. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Additional context
Representative crash report (all point to this same series of RevenueCat library calls):

Hardware Model:     iPhone13,2
Process:            Bakesy
Identifier:         app.bakesy.internal
Version:            2.3.6
Role:               Foreground
OS Version:         iOS 16.1.1

App Hang: The app was terminated while unresponsive

0  libsystem_pthread.dylib +0xba8 _thread_chkstk_darwin
1  libswiftCore.dylib +0x232b30   String.UTF8View._foreignSubscript(position:)
2  libswiftCore.dylib +0x2191ac   specialized __StringStorage.appendInPlace<A>(_:isASCII:)
3  libswiftCore.dylib +0x218e00   _StringGuts._foreignAppendInPlace(_:)
4  Bakesy +0x3c82cc               DefaultStringInterpolation.write(_:) (<compiler-generated>)
5  Bakesy +0x3408f0               static PostReceiptDataOperation.createFactory(configuration:postData:customerInfoResponseHandler:customerInfoCallbackCache:) (CustomerInfoResponseHandler.swift)
6  Bakesy +0x3f7678               Backend.post(receiptData:appUserID:isRestore:productData:presentedOfferingIdentifier:observerMode:initiationSource:subscriberAttributes:completion:) (Backend.swift:109:23)
7  Bakesy +0x3fd14c               closure #1 in PurchasesOrchestrator.fetchProductsAndPostReceipt(withTransaction:receiptData:initiationSource:storefront:) (PurchasesOrchestrator.swift:869:22)
8  Bakesy +0x3f17d8               closure #1 in closure #2 in PurchasesOrchestrator.products(withIdentifiers:completion:) (PurchasesOrchestrator.swift:189:17)
9  Bakesy +0x82198                thunk for @escaping @callee_guaranteed () -> () (<compiler-generated>)
10 libdispatch.dylib +0x24b0      __dispatch_call_block_and_release
11 libdispatch.dylib +0x3fd8      __dispatch_client_callout
12 libdispatch.dylib +0x127f0     __dispatch_main_queue_drain
13 libdispatch.dylib +0x12440     __dispatch_main_queue_callback_4CF
14 CoreFoundation +0x9a6f4        ___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
15 CoreFoundation +0x7c054        ___CFRunLoopRun
16 CoreFoundation +0x80ed0        _CFRunLoopRunSpecific
17 GraphicsServices +0x1364       _GSEventRunModal
18 UIKitCore +0x3a23cc            -[UIApplication _run]
19 UIKitCore +0x3a2030            _UIApplicationMain
20 Bakesy +0x6cb8                 main (main.m:8:12)
21 dyld +0x1595c                  start

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions