question

brendan avatar image
brendan asked

Cloud Script ServiceUnavailable ?

richjoslin
started a topic on Tue, 22 September 2015 at 8:53 PM

I'm trying out Cloud Script, and when trying to use RunCloudScript (Unity 4.6 C#), I get a ServiceUnavailable error back. I know PlayFab is working since my login and other API calls are working. What might I be doing wrong?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

20 Comments
richjoslin said on Wed, 23 September 2015 at 1:04 PM

Tried calling Matchmake, and I get the same ServiceUnavailable error. Logging in and getting my friends list works fine though.


Brendan Vanous said on Wed, 23 September 2015 at 5:44 PM

Hi Rich,

That's odd - I'm not seeing any service issues here. Is this a consistent repro for you? If so, what Title ID and PlayFab ID are you using for these tests?

Brendan


Brendan Vanous said on Thu, 24 September 2015 at 11:08 AM

For anyone following this thread, please be sure to call GetCloudScriptUrl once on your title's start, and use that URL for your Cloud Script calls.

For Matchmaking, please note that Matchmake is designed to work with your custom game servers - if you have any trouble uploading your build, please have a look at this guide: https://support.playfab.com/discussions/topics/1000040625

Brendan


flekoun said on Sun, 27 September 2015 at 12:13 PM

This is strange. We are now having a lot of people complaining about loosing connection. We are also getting here a lot of ServiceUnavailable on our devices :( Is really everything ok on Playfab side? Out title ID 5285


Brendan Vanous said on Sun, 27 September 2015 at 2:08 PM

Hi Jan,

I'm not seeing any errors here, but I'm checking with the engineering team to be absolutely sure. I just tried a few calls against your title and it all looks good. Are there particular calls you're getting the error from?

Brendan


flekoun said on Sun, 27 September 2015 at 2:14 PM

Well, the PlayFabClientAPI.GetCloudScriptUrl() gets through and returns URL: https://5285.playfablogic.com/1/prod. So it looks good. However after we call the 1st PlayFabClientAPI.RunCloudScript() API call ( in our case it is"CurrentTime" which gets current time from server) it often return the ServiceUnavailable error. However after few other attempts it usually start working, which is strange :(


Brendan Vanous said on Sun, 27 September 2015 at 4:30 PM

Thanks - we're checking the logs, to see what the logs show. We'll update here when we have more info.

Brendan


Brendan Vanous said on Mon, 28 September 2015 at 2:41 PM

Hi again,

This appears to have been a transient issue, due to a high level of Cloud Script calls. We've updated the service to account for larger spikes, to help make sure this won't re-occur. Let us know if you run into any further issues.

Brendan


flekoun said on Tue, 29 September 2015 at 12:38 AM

Hello, thanks for your effort. Unfortunately we find out it has nothing to do with cloud-script probably. Just regular API calls are returning Service Unavailable. But it is not constant. Just the service seems unstable or we are doing something wrong. Our players are simply being kicked waaay to often because of this Service Unavailable error :(


flekoun said on Tue, 29 September 2015 at 12:45 AM

Just now on my device 3 times a row, when I collect tribute. Which calls these API calls together:

PlayFabClientAPI.SubtractUserVirtualCurrency 

PlayFabClientAPI.AddUserVirtualCurrency



PlayFabClientAPI.UpdateUserData

this resulted in Service Unavailable error callback 3 times in a row :(


Brendan Vanous said on Tue, 29 September 2015 at 1:10 AM

We're re-checking everything now, to ensure there aren't any issues at the service layer. We'll update shortly.

Brendan


flekoun said on Tue, 29 September 2015 at 1:19 AM

Just last note, the error message with codes is :

Got an error: ServiceUnavailable ErrorMessage: 409: Conflict HttpCode: 503


Brendan Vanous said on Tue, 29 September 2015 at 1:44 AM

Got it - thanks for the details. We'll check the logs to ensure this is resolved.


flekoun said on Tue, 29 September 2015 at 6:50 AM

Just found another strange thing. When I look at API usage report in the Dashboards for our game I can see that on 25. September and before this date we had like 20-100 Error statuses for each day reported. Since 26. September this number jumped to 60,000 (yes 60 thousands!) error statuses and continue to do so till today :( We didn't published any update of the game on stores, last update was on 21. September.


Brendan Vanous said on Tue, 29 September 2015 at 9:00 AM

Hi again,

Can you have a look at the specifics of the error message, to see if you're getting this in the details of the response:

"A conflict occurred trying to make multiple edits to the same data at the same time"

Looking at our logs, it appears that the title is attempting to update the same Key in multiple simultaneous calls. Can you think of anywhere in the code this might happen in your title?

Brendan


flekoun said on Tue, 29 September 2015 at 9:28 AM

Hi,

the PlayFabError.ErrorDetails is always null so I cannot get more info about the error :(


Brendan Vanous said on Tue, 29 September 2015 at 9:41 AM

That's very odd - we're adding some extra logging on our side, to track this down and we'll update shortly. Can you have a look to see if it's possible for the title to attempt to write to the same data Key more than once in a loop somewhere? The calls would need to be back-to-back, effectively.

Brendan


flekoun said on Tue, 29 September 2015 at 9:48 AM

Hi, I am just checking now and it seems that you nailed it. Sometimes the game is calling 2nd API call (UpdateUserData) to update the same key again right after the 1st one. However now I am getting : "Back-end server is at capacity" error so I cannot check more right now.


flekoun said on Tue, 29 September 2015 at 10:07 AM

Well I am not sure now.Check this out:

SubtractUserVirtualCurrency , {"VirtualCurrency":"ME","Amount":4}





AddUserVirtualCurrency , {"VirtualCurrency":"GO","Amount":701}





UpdateUserData , {"Data":{"Player_Level":"100","Player_Exp":"4670"},"Permission":"Public"}





UpdateUserData , {"Data":{"DailyTask_COLLECT_TRIBUTE_available":"True","DailyTask_COLLECT_TRIBUTE_progress":"3","DailyTask_DRAW_CARDS_available":"True","DailyTask_DRAW_CARDS_progress":"0","DailyTask_UPGRADE_CREATURE_available":"True","DailyTask_UPGRADE_CREATURE_progress":"0"},"Permission":"Public"}

These 4 calls sometime result in ServiceUnavailable error. I am not sure whether there might be some 5th call that is not printed into the debug log as I am catching these logs in your PlayFabHTTP.Post() method.


Brendan Vanous said on Tue, 29 September 2015 at 6:49 PM

Okay, everything has been tracked down - first off, these two errors are completely unrelated. Their appearance close in time is just a coincidence.

Service Unavailable (409): This was being caused by specific high-load issues in the service. We're taking steps to reduce these and eliminate them wherever possible. One thing developers can do to assist with that is to always let us know what your content/promotion/user acquisition plans are, so that we're aware of any potential for major spikes (don't worry - a few thousand users isn't a spike).

Conflict (503): This was being caused by multiple attempts to write data values for the title simultaneously (multiple different calls, that is - not multiple values in one call). We've updated the service to eliminate this issue, so you shouldn't run into it again.

Brendan

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dylan Hunt avatar image Dylan Hunt commented ·

GetCloudScriptUrl -- is this necessary in the current version? I don't believe I'm using this.
EDIT: Obsolete
https://api.playfab.com/documentation/client/method/GetCloudScriptUrl

0 Likes 0 ·
brendan avatar image brendan Dylan Hunt commented ·

Correct, we've since deprecated that call, and moved to simply ExecuteCloudScript. Please bear in mind that when we update API calls, it's almost never going to be possible for us to go through the entirety of the forums and update all old posts. If you ever have questions on old posts such as this one, the best thing to do is to just post the question (as you did).

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.