playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.45k stars 961 forks source link

Stuck in serverside conflict loop until google play services app data is cleared #1262

Open miracle7 opened 8 years ago

miracle7 commented 8 years ago

We are having a strange issue where a serverside conflict is always returned when trying to open the metadata, no matter how many times we resolve it.

It seems to be local to the device as other devices still work as expected when this starts happening.

Cloud save works as expected again if we clear the google play services app data (not just the cache). We are passing the 'ReadNetworkOnly' parameter to the open meta data function, but despite this google play games appears to be doing something offline.

In addition to this strange serverside conflict loop it gets stuck in, if the device has no internet connection and tries to open the metadata, instead of coming back with an error code, it waits a long time before returning the success code and behaving as if it is connected.

Can anyone think of anything I could possibly be doing to cause this to happen? We can not get a reliable repro for this issue and it is causing a lot of problems for our users.

mbhaskar1 commented 8 years ago

Don't have anything to add, but I can confirm I am encountering this problem as well

claywilkinson commented 8 years ago

Thanks for all the confirmations! The SDK team is looking at - and have reproduced the issue. I will give an update when I know more.

mbhaskar1 commented 8 years ago

How much longer do you think it will take to fix this issue? Development is going pretty slow because of this.

claywilkinson commented 8 years ago

I don't have a firm timeline. One question did come up, when you save the data calling commit, do you open the file again to commit the second time, or do you just reuse the metadata object?

mbhaskar1 commented 8 years ago

I open the file again every time.

claywilkinson commented 8 years ago

Thanks - the quick responses help!

FredoFidel commented 8 years ago

Same here. Reopening the file every time.

mbhaskar1 commented 8 years ago

I just realized this issue has been here for like a month O_O. Should I even expect it to be solved, or switch to another backend completely.

jeehyunho commented 8 years ago

For reference, In my case Nexus 5 device shows stuck in conflict loop problem frequently but not Galaxy S6. I also test the Unity plugins supporting Saved Games (Android Native plugin, Cross Platform Native plugin) and I've experienced they all have same problems too.

I've checked over several games using Saved Games service which already launched in Google Play. I am surprised that almost all games got the same issue and it is not solved yet almost two months.

a3dline commented 8 years ago

hi/ Can uoy suggest a correct fix this bug too. We use cloud synch in our app and face this bug too. We make a desigion to turn synch off for now, but we'll like to keep this option for users that needed cloud Thx

MobileMonsters commented 8 years ago

So, we've implemented our own solution for saving and syncing files that we currently use for saving the players' progress).

The only thing we now need is to retrieve the ServerAuthCode on the client and send it to our server. The server identifies to user with Googles' OAuth calls etc. But it sometimes happen that we get an error when retrieving this code on the client:

GetServerAuthCode() ERROR: Error loading server auth code: ERROR_INTERNAL

Are you aware of this issue? Is there a current workaround or something that I could do wrong like requesting an auth code too often e.g.?

mbhaskar1 commented 8 years ago

MobileMonsters can you tell me what method you're using to save and sync files, because I am at the point where I am resorting to saving all player data as encrypted data on the player's phone (which is really unsafe and open to hacking / cheating)

claywilkinson commented 8 years ago

@MobileMonsters - You should not need to call GetServerAuthCode too often (How often are you calling it?). Once the server has exchanged the code for an access token, you should have a refresh token as well which is used by the server to keep a valid token for that user.

DrappierTechnologies commented 8 years ago

I signed up to GitHub for the explicit purpose of commenting on this issue. I too am facing the issue and I don't even use this plugin I use a different plugin that wraps the Google Play APIs. The issue is exactly as mentioned, when attempting to resolve a conflict it gets stuck in a loop which either crashes the app or ends after a really long period of time both of which are unacceptable for production behavior. As it stands, everything else is complete and I'm just stuck sitting on my hands until this gets fixed. Glad to hear the team is working @claywilkinson .

DaveBigPixel commented 8 years ago

Hi @claywilkinson, any updates on this? Thanks

ghost commented 8 years ago

Hey,

Is it common behavior from Google to have errors such as this one in production? I cannot believe, it has been over 2 months and the issues with saved games still are not fixed. These issues are the only only reason that keeps me from publishing my game. I am also getting afraid of publishing using Google Play Game Services in case something similar happens after the publication. @claywilkinson Any comments?

mbhaskar1 commented 8 years ago

I think @claywilkinson has abandoned this issue, and has decided to just ignore all 24 of us, because him and his team can't solve the problem. I would just either use another backend like Gamesparks, Playfab, or Photon, or some other solution, because I don't think this will be solved anytime soon, and they are definitely a lot more reliable

stephanedupont commented 8 years ago

@claywilkinson : starting to getting pissed off, like the others. Unlike @TuuttitaR, for me the app is already published. When discovered, that kind of thing should be fixed in a matter of days, not weeks or months!

And yeah @TuuttitaR, it's common for Google to ignore these things, just have a look here for example: https://code.google.com/p/android/issues/detail?id=197287

stephanedupont commented 7 years ago

I'm receiving more and more user reports saying the sync is not working for them anymore.

Can we please get an update @claywilkinson?

ghost commented 7 years ago

@claywilkinson : Are the issues with saved games going to get fixed or not? If they are, when is that going to happen? Can we please get a straight answer or update?

claywilkinson commented 7 years ago

Here is what I recently was able to track down:

There was a bug in the play services app (not the library) that caused the old data to sometimes be incorrectly returned. Then, having multiple commits to update that data could cause the infinite loop of conflict resolution.

Some analysis of games (including the sample apps) could also have overlapping open calls to the same file, which also can cause the infinite conflict loop.

Fixes:

  1. An update is rolling out to play services which will prevent any new instances of the old data being incorrectly returned. This should reach all devices before the end of the month.
  2. A fix for existing cases will be rolling out in the next update - which I don't know the exact date, but sometime in Q4 is a good guess.
  3. We'll be updating the samples to be a good reference on how to safely use the Snapshots API for saved games, so developers can make sure they use it without causing this problem.

Thanks again for your patience and persistence.

felipeota commented 7 years ago

@claywilkinson Regarding your two points marked as 1, are those two separated fixes? Can we expect the first fix sooner? Can we really use this api safely? Do calls to open from different devices count as overlapping? What happens if the app crashes when the file is open and we reopen it again on startup? do those count as overlapping as well?

stephanedupont commented 7 years ago

@claywilkinson So for every user having this problem, they will continue to experience it until "sometime in Q4"? Tell me it's a joke, please....

claywilkinson commented 7 years ago

@felipeota - Yes, the first fix is rolling out now. Overlapping commits across devices works as it should and create 1 conflict per commit. The problem happens when the same version of a file has local commits against it. Opens are technically OK, it is the commit that causes the problem.

qbit86 commented 7 years ago

We've got the same issue. (Our game is quite big, over 10M installs from Google Play.)

So, the solution is to wait until users update their Play Game Services application, isn't it? Or we need to release new build with updated version of Unity plugin? Any ETA?

Maria-Angelova commented 7 years ago

Joining the crowd, Limbo is also experiencing this issue, using java and BaseGameUtils lib. Our code is pretty much like the examples code - up to 3 recursive attempts to resolve the issue, if either is successful we merge the data manually and try to save it into the resolved snapshot. Often getting a conflict response at that point. The only difference is that we open the two snapshots and read them fully before calling resolveConflict and the later is done in a task. We cannot repro, this info is based on user logs.

@claywilkinson Can you confirm that on a device already experiencing the problem either clearing cache or data on the Google Play Services or Google Play Games apps will resolve the problem? Has fix 1. been rolled out already? Cause we have new players reporting the problem as of today. Do you need more, fresh logs?

survivann commented 7 years ago

Also still experiencing this issue. Google Play Games app hasn't been updated since 18th July so I guess fix 1 has not been released.

danielvandenberg95 commented 7 years ago

OP of aforementioned http://stackoverflow.com/questions/37467990/play-games-snapshot-conflict-resolution-gives-conflict joining in for updates. Also still experiencing the issue.

stephanedupont commented 7 years ago

@claywilkinson, still got some users encountering this problem. Is it supposed to be totally fixed?

stea1thbear commented 7 years ago

Also still getting this issue. If I commit multiple snapshot saves while disconnected from the internet on device 1, then submit a save on device 2 which is connected to the internet, then come back to device 1 and connect to the internet and attempt to open a snapshot I get this conflict loop issue every time.

@claywilkinson Which example project should be followed to prevent this issue from occurring? Thanks.

Update: After some further searching, I'm GUESSING you need to use SnapshotCoordinator Class. According to the class:

/**

  • The SnapshotCoordinator is used to overcome some dangerous behavior when using Saved Game API
  • (aka Snapshots). The problem is caused by the not having way to prevent having the same file
  • opened multiple overlapping times. Also there is no way to stop the incorrect reusing of
  • the Snapshot contained in the OpenSnapshotResult object. It should be used once to write or be
  • closed. Multiple commits using the same snapshot will result in unrecoverable conflicts.
  • This class is used to encapsulate the access to the Snapshots API and enforce these semantics of
  • exclusive file access and one-time committing of metadata.
  • How to use this class
  • This class can be used as a drop-in replacement for Games.Snapshots. If the usage of the API
  • is inconsistent with enforced rules (any file can be open only once before closing it, and
  • snapshot data can only be committed once per open), then an IllegalStateException is thrown.
  • NOTE: *** The one exception to the drop-in replacement is that each call that returns a
  • PendingResult, that PendingResult MUST be processed by setting the ResultCallback
  • or bycalling await().
  • This is important to make sure the open/closed book-keeping is accurate.
  • To make it easier to use Snapshots correctly, you should call SnapshotCoordinator.waitForClosed()
  • to obtain a PendingResult which will be resolved when the file is ready to be opened again. */

SnapshotCoordinator Class: https://github.com/playgameservices/android-basic-samples/blob/master/BasicSamples/libraries/BaseGameUtils/src/main/java/com/google/example/games/basegameutils/SnapshotCoordinator.java

Example That Leverages it: https://github.com/playgameservices/android-basic-samples/blob/master/BasicSamples/CollectAllTheStars2/src/main/java/com/google/example/games/catt2/MainActivity.java

Athomield commented 6 years ago

I'm getting an InternalError from savedGameClient.OpenWithAutomaticConflictResolution continusouly. It used to work fine until I deleted the data from google drive (manage apps tab). I'm not sure if this is related but it doesn't seem to have a real reason behind it.