Skip to content

All calls to save() or fetch() on ParseUser and ParseInstallation will freeze if previous call to saveEventually() has failed #827

Closed
@cjosepha

Description

@cjosepha

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)

  1. Log in
  2. Delete user session on the server
  3. Put new data to user
  4. Call user.saveEventually() -> Returns invalid session token error (expected)
  5. Close app and relaunch it
  6. Put new data to user
  7. 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()

https://github.com/DanGTZ/Parse-Android-SDK-Test/blob/master/app/src/androidTest/java/com/perfexpert/parsetest/ParseSaveEventuallyTest.java

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions