Description
After ParseUser.saveEventually() or ParseInstallation.saveEventually() has failed, the sdk seems to be in a corrupted state as all subsequent calls to save() or fetch() on ParseUser and ParseInstallation will freeze. Restarting the app or the device will not solve the issue and only a re-installation of the app allows to save/fetch ParseUser/ParseInstallation again.
This issue occurs with any version of parse-server and any version of Parse-SDK-Android.
Steps to reproduce the issue on ParseUser (same for ParseInstallation)
- Log in
- Delete user session on the server
- Put new data to user
- Call user.saveEventually() -> Returns invalid session token error (expected)
- Close app and relaunch it
- Put new data to user
- Call user.save() -> Freeze forever
Note that terminating the app then relaunching it will not change anything : any call to user.save() will freeze (as user.saveInBackground() never completes).
Parse initialization code used
Parse.setLogLevel(Parse.LOG_LEVEL_VERBOSE);
Parse.initialize(new Parse.Configuration.Builder(application)
.applicationId(BuildConfig.PARSE_APP_ID)
.clientKey(BuildConfig.PARSE_CLIENT_KEY)
.enableLocalDataStore()
.server(BuildConfig.SERVER_URL + ":" + BuildConfig.SERVER_PORT + "/parse/")
.build());
Standalone app showing the issue
https://github.com/DanGTZ/Parse-Android-SDK-Test
The tests testSaveEventuallyInstallation and testSaveEventuallyUser passe the first time they are launched, then subsequent launches will freeze on the first save()
Workaround
This issue occurs after loading invalid data from the cache at step 5. To prevent loading invalid data at startup, clear the ParseUser or ParseInstallation disk cache just after the saveEventually() has failed (step 4). To do so, you can use this gist : https://gist.github.com/DanGTZ/7c95d6fc0bb95d3d7433ab7dc309eeac