-
Notifications
You must be signed in to change notification settings - Fork 655
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
Cascade cache remove loops forever on cyclic references #6133
Comments
Thanks for sending this 🙏 Do you have a reproducer by any chance? The |
Yes I missed that, you're right the entries should be removed from the journal and lruCache in the memory cache. For some reason the process gets stuck though. I will investigate more and maybe setup a reproduction. |
Okay I think I got it. The problem is in the SQL cache (I have the memory cache chained to SQL) Here is the offending method: Line 124 in e969ade
It keeps trying to delete children before itself and thus create a loop. |
Excelent catch! Do you want to submit a fix?
|
Sure, I'll see when I'll get to it though :) |
Okay I took a look at this and I stopped at having trouble with just opening the Apollo project in the IDE. I tried both Android Studio and IDEA but they fail at processing the source files. I guess it would be faster for you to fix this properly, it should be very simple for you. |
Interesting. This was an issue a couple of years ago but it's been a while I haven't seen any issue. Do you have any Gradle sync issue? |
Gradle sync passes, I found out the issue is caused by the SQLDelight plugin. Do you use it without any issues? Disabling it fixed both IDEs. |
Ah good catch. Indeed, I do not have the SQLDelight plugin installed. Might be worth filing a bug if it's reproducible, I'll look into this. Do you still want me to do the patch? |
I reported the exceptions from IDEA. I'm working on the patch now 😎 |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Kotlin usage and allow us to serve you better. |
Version
4.0.0
Summary
Our schema:
When deleting the Record object using its CacheKey with cascade = true. It seems to loop forever.
Here's the remove method:
apollo-kotlin/libraries/apollo-normalized-cache-api/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/api/internal/OptimisticCache.kt
Line 46 in e969ade
Just looking at the code, there is a recursive call which probably calls remove between those two objects indefinitely. The cascade remove should probably gather all unique references first and then delete them.
The text was updated successfully, but these errors were encountered: