Skip to content

DeviceCache: added verbose logs for init/deinit#2101

Merged
NachoSoto merged 1 commit into
mainfrom
device-cache-init
Dec 7, 2022
Merged

DeviceCache: added verbose logs for init/deinit#2101
NachoSoto merged 1 commit into
mainfrom
device-cache-init

Conversation

@NachoSoto

@NachoSoto NachoSoto commented Nov 29, 2022

Copy link
Copy Markdown
Contributor

Equivalent to #2082.
This change will help continue debugging CSDK-517.

While debugging locally I ran into this crash:

Test Case '-[StoreKitUnitTests.UserDefaultsDefaultTests testDefaultIsRevenueCatSuiteIfStandardDoesNotContainUserID]' started.
RevenueCat/DeviceCache.swift:85: Fatal error: [Purchases] - Cached appUserID has been deleted from user defaults.
This leaves the SDK in an undetermined state. Please make sure that RevenueCat
entries in user defaults don't get deleted by anything other than the SDK.
More info: https://rev.cat/userdefaults-crash

But that should have been impossible because the current test had not initialized Purchases or DeviceCache, which showed that there was a leaking DeviceCache from another test.

Equivalent to #2082.
This change will help continue debugging [CSDK-517].

While debugging locally I ran into this crash:
```
Test Case '-[StoreKitUnitTests.UserDefaultsDefaultTests testDefaultIsRevenueCatSuiteIfStandardDoesNotContainUserID]' started.
RevenueCat/DeviceCache.swift:85: Fatal error: [Purchases] - Cached appUserID has been deleted from user defaults.
This leaves the SDK in an undetermined state. Please make sure that RevenueCat
entries in user defaults don't get deleted by anything other than the SDK.
More info: https://rev.cat/userdefaults-crash
```

But that should have been impossible because the current test had not initialized `Purchases` or `DeviceCache`, which showed that there was a leaking `DeviceCache` from another test.
@NachoSoto NachoSoto merged commit 43e5387 into main Dec 7, 2022
@NachoSoto NachoSoto deleted the device-cache-init branch December 7, 2022 22:37
NachoSoto added a commit that referenced this pull request Dec 12, 2022
…2105)

Follow up to #2104. See also #2101. This has uncovered a huge source of
leaks across many tests. Fixing this provides many benefits:

- Faster test runs
- Lower memory overhead
- Isolated state across each test run
- Ensure that these types don't leak outside of tests too
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants