-
-
Notifications
You must be signed in to change notification settings - Fork 735
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
fix: users logged out after SDK upgrade due to different cache path #1168
Conversation
ParsePlugins :: - `getCacheDir()`, `getFilesDir()` APIs now has support for backward compatibility before migration to v3.0.0
Thanks for opening this pull request!
|
Codecov Report
@@ Coverage Diff @@
## master #1168 +/- ##
============================================
+ Coverage 66.81% 67.31% +0.50%
- Complexity 2249 2285 +36
============================================
Files 121 122 +1
Lines 9892 9962 +70
Branches 1332 1343 +11
============================================
+ Hits 6609 6706 +97
+ Misses 2771 2735 -36
- Partials 512 521 +9
Continue to review full report at Codecov.
|
Here you can see an migration logic about the push notifications, I have expected to see something similar but much more simple: 7d0faa3#diff-6cb14853da236c30db3f14e4005ea40c5c45cb8fcb9fc49541693186620de1dcR60 |
@rommansabbir Thanks for the PR, but looking at the proposed fix I think it is not gonna work at all. There are potentially multiple cached files stored in both, the cache dir and the files dir. Your code will probably allow to read them from the original location, and then you delete them when the app exists (assuming the delete on exit works, as it might not as @L3K0V explains). The actually files we care about are never moved anywhere, and even if they will have been be re-saved by the app at some point, they would end up in the old location and then then get deleted. Needs more work IMHO... |
Hi everyone, just to emphasize it, this is a particularly important PR, because any release without this migration logic is for most people likely a useless release. So this PR currently blocks the release pipeline. The sooner we get this merged the better, considering we have another issue with Facebook Login that is waiting to get merged. Any helping hand here is greatly appreciated and we have a bounty on this issue as well. |
@mtrezza @mman @L3K0V First of all, sorry for messed up with the PR. This is my first contribution to a such big community of Parse. About my logic for cache path migrations. Based on @mman migration thoughts (#1158 (comment)) I came up with this ::
If the solution seems suitable for migration process, I will create a new PR (which will include changes in Let me know, Thanks. |
@rommansabbir Yes, this is the approach I would take, but please note that since 3.0.0 is already in the wild, and since it forced people to re-login, there will be cases where there will be fresh files in new location |
One things more, in the old version, I have seen that So, when running migration, for a specific file, in which location I should point to move the spcific file, |
@rommansabbir That is exactly what I have not yet had a time to investigate properly and in detail (read: This PR is actually trickier then it may appear on a first look). |
@mman I think we can find out from where the old API is accessed and which |
The two storages have a different purpose and are managed differently. That determines which file should go where.
For example, the user session token would go into persistent storage. I would just make a list of all the SDK's internal files from looking at the pre-3.x logic, post the list here and then we can determine whether it should be persistent or not. That wrapped into the logic I proposed earlier should do the trick. I don't think there is a lot more to it. |
from where After that, all other files that left in
Version: 2.0.6
calling |
Sounds good; how about the other modules like facebook, fcm, it is possible that they store anything in there as well?
What are these other files? Reopening this PR, as the issue conversation is happening here instead of in the issue. I guess this PR can just be extended with the modifications discussed above, instead of opening a new one. |
@mtrezza I found those usages in the mentioned list. If any other module deal with File, at the end they all point to the same API
I'm not sure about how many files (
|
In general I agree with your strategy, but I wonder what these other files could be? I assume it's only the Parse SDK itself that writes to that dir, so any write logic, even for temporary files should be identifiable in code. Have you seen that there are also other files, or is that just an assumption? Or is it that the OS uses the cache dir of a module automatically to store cache files that are opaque to us? |
OK, so I guess let's go with your suggested migration concept and then just test it out.
You mean pre 3.x or even with the latest version of the SDK? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix: parse cache dir migration routine on SDK initialization (only once) (#1168)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but it would be great if someone else take a look as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed SpotlessJavaCheck Violations gradle build issue for PR (#1168)
@PLR2388 Since you originally reported the issue, do you think you could test out this fix to see whether the migration happens successfully? Would be nice to have a pre-release branch to test things out easier, to consider for the future. |
Given the severity of the issue, I would like to have someone test this out with an actual app before we merge it and recommend to developers that the release is safe to use. That means:
If @PLR2388, @qmetzler-luna or @mman could try that out, that would be fantastic. |
@mtrezza @mman I have tested the "patch-1" version to check the migrations status & users logged out issue. Migrations was successful & users stayed logged in after SDK version updates from 2.x to patch-1. Step 1: Step 2:
The result is as we expected 😃 |
@rommansabbir Thanks for documenting it in such detail. I will try this out as well just to confirm before we merge. Side note, since you already did a lot of investigation, do you know why the |
@mtrezza I will review the codes and will update you. |
@rommansabbir I will try to test until the end of this week... |
@mtrezza According to the code comments:
|
Thanks for investigating, so the |
I can confirm that the migration works fine. It moves from
It moves from
The following file locations are unchanged:
Everything as expected, installation update and user requests server side also work fine. Great job, @rommansabbir! Would you be interested in joining the Parse Android SDK team? No commitment in terms of contribution, but it would be great if you could at times help out with things like PR reviews for example. |
Changelog entry:
|
@mman If you want to test that would be great, then we'll wait until the end of the week with the release. |
Yes, I would love to 😃 |
@rommansabbir @mtrezza I'd love to double check, the code looks good. What's the easiest way to build my app against this branch. I have tried naive approach to depend directly on git branch, but that apparently does not work. What steps are needed? Sorry for my lame question. |
Add this branch dependency:
I was able to install by following this approach. Now, you can install the latest SDK from this branch. |
You can also clone the repo, checkout the PR branch, build to local maven and reference the builds in your example app. I think that's a question many may have; maybe we should add a step-by-step instruction to the contribution guide. |
Thanks @rommansabbir, I was missing the
I have now tried our apps and looks like this PR does correctly move all files around. Thanks, LGTM 👍 |
Thanks confirming @mman. We now have 3 confirmations that this PR works, so I will go ahead and merge. Great teamwork everyone and thanks especially to @rommansabbir for kicking it off with this PR! |
## [3.0.1](3.0.0...3.0.1) (2022-05-26) ### Bug Fixes * users logged out after SDK upgrade due to different cache path; this fixes the bug that was introduced with release 3.0.0 which ignores SDK-internal data that is stored locally on the client side ([#1168](#1168)) ([ec7bd03](ec7bd03))
🎉 This change has been released in version 3.0.1 |
ParsePlugins ::
getCacheDir()
,getFilesDir()
APIs now has support for backward compatibility before migration to v3.0.0