playgameservices / android-basic-samples

Google Play game services - Android samples
Apache License 2.0
970 stars 972 forks source link

GamesClientStatusCodes.SNAPSHOT_CONTENTS_UNAVAILABLE status code returned when opening save backing #335

Open JoeyRosicka opened 3 years ago

JoeyRosicka commented 3 years ago

A description of the problem, and the behavior you expected instead. Many of our users encounter a GamesClientStatusCodes.SNAPSHOT_CONTENTS_UNAVAILABLE status code when attempting to open their SnapshotsClient save backing on app startup. The expected behavior is for these users to be able to successfully open their save data.

A list of steps and/or a small snippet of sample code that can be taken to reproduce the problem in another app.

_snapshotsClient.open(SNAPSHOT_NAME, allowCreation).addOnCompleteListener(new OnCompleteListener<SnapshotsClient.DataOrConflict<Snapshot>>() {
public void onComplete(@NonNull Task<SnapshotsClient.DataOrConflict<Snapshot>> task) {
    shouldCancelTimer = true;
    if (openExpired) {
        debugLog("Save backing opening complete, but the timer has expired. Discarding.");
        return;
    }
    Log.tagI(TAG, "Open returned with result %s", task.isSuccessful());
    String statusMessage;
    try {
        SnapshotsClient.DataOrConflict<Snapshot> result = task.getResult(ApiException.class);
        debugLog("Result retrieved");
        if (!result.isConflict()) {// if data was successfully loaded and is up-to-date.
            snapshot = result.getData();
            statusMessage = "ok";
            debugLog("No conflict. " + (suppressLocalConflict ? "Proceeding." : "Checking for local conflict."));

...

    } catch (ApiException ex) {
        String err = "Google Play reported: " + CommonStatusCodes.getStatusCodeString(ex.getStatusCode());
        switch (ex.getStatusCode()) {
            case GamesClientStatusCodes.SNAPSHOT_CONTENTS_UNAVAILABLE: 
                statusMessage = "snapshot contents unavailable";
                openFailed(callbacks, SaveBackingErrorCode.SERVICE_ERROR, err);

...

        }
    }
}

When this bug started happening, and the frequency it occurs. The first case we saw was on July 10th, 2021 (a couple per day). We saw a surge of cases on July 23rd, 2021 (~200 per day), then a bigger surge on July 30th, 2021 (~1300 per day).

A description of any workarounds you have found. None.

A log file with a stack trace of the problem. To learn how to use the Android logging system, see Reading and Writing Logs. We are unable to reproduce this so are unable to provide logs.

The main thing we're looking for here is any details about the cause of a GamesClientStatusCodes.SNAPSHOT_CONTENTS_UNAVAILABLE status code and whether there's anything we can do on our end to try to resolve it. The timeframe of when this started appearing does not line up with any app updates or other changes on our end, so we're confused about what could have triggered the surge of these cases.

olehkuznetsov commented 3 years ago

Can you share your game package name, please?

smile616 commented 3 years ago

In regards to the cases count, do you have the same stats but for number of affected users per day?

JoeyRosicka commented 3 years ago

The package name is com.concretesoftware.pbachallenge_androidmarket

As for affected users per day: July 10th: ~5 users per day July 23rd: ~100 users per day July 30th: ~600 users per day It seems like these same users are being affected day-after-day.

smile616 commented 3 years ago

Thank you, @JoeyRosicka.

JoeyRosicka commented 3 years ago

Update on our end - still these same ~600 users who are getting SNAPSHOT_CONTENTS_UNAVAILABLE when attempting to retrieve their save snapshot. The documentation on this notes to "See the device logs for more details" and we have been able to take a look at some logcats, but we are not seeing anything related to the error.

It's been tough to find any additional information on SNAPSHOT_CONTENTS_UNAVAILABLE. Are there any notable situations where this error occurs?

smile616 commented 3 years ago

@JoeyRosicka, thank you for the update.

Are there any notable situations where this error occurs? Usually this code should be returned only if user lost the Internet connection while snapshot BLOB download.

We are investigating the issue on the Play Service side. Would it be possible to share logcats/bugreports with us? Preferably link to a Google Drive folder but, please, don't accept access request unless it from @google.com email addresses.

JoeyRosicka commented 3 years ago

@smile616 here is a logcat from one of the affected users - I'll grant access when I see a request. https://drive.google.com/drive/folders/1kM-LysGy4xL6jcKujJAELAcVCmZNPBXz?usp=sharing

Also this is probably implied, but just in case I'll note that this is a high-priority issue for us since we have a lot of users unable to access their save data. Thanks for continuing to look into this.

smile616 commented 3 years ago

Thank you, @JoeyRosicka. Access request sent.

smile616 commented 3 years ago

@JoeyRosicka We've applied some steps on the Play Service side that should mitigate the error rate. I keep the issue open for monitoring.

JoeyRosicka commented 3 years ago

Thanks, very good to hear.

JoeyRosicka commented 3 years ago

It looks like the error rate has dramatically decreased since August 10th which appears to line up with when you reporting your change on the Play Services side. Now seeing 5-10 users affected per day rather than hundreds.

smile616 commented 3 years ago

Thank you, @JoeyRosicka, for the update.

JoeyRosicka commented 3 years ago

No problem @smile616. Please let me know if there's anything we can do to help get the error rate down to 0.

smile616 commented 3 years ago

Hi @JoeyRosicka, unfortunately, there is nothing can be done on your side. We expect that the error rate will reduce to 0 organically by mid September.

JoeyRosicka commented 3 years ago

Alright, thanks for the update.