question

chris-3 avatar image
chris-3 asked

Error 409 UpdateUserInternalData

Getting a few failures per hour with 409 on a Cloudscript that writes to the UserInternalData.

The first two cases I found for the function were on accounts that wrote this particular key for the first time. And there are no other recorded attempts to write to this key in the event history.

Two questions:
1. Can I get a conflict like this is I write to two different keys? About three other keys get written too in the same minute in one case without problem then this error occurs then another key is written correctly.
2. Any suggestions on how to avoid getting this error in future? It looks like a few cloudscripts have the problem.

10 |1200

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

Seth Du avatar image
Seth Du answered

Error 409 usually occurs when there are concurrent API calls that try to update the same data at the same time. You need to wait for receiving the response from the first call before you make the second call. It’s better to review your update user data related codes and reorganize the update work flow. Additionally, for more information, please see Brendan’s comments in this thread.

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.

chris-3 avatar image chris-3 commented ·

I'd shielded writes to the same data. I had hoped/expected that different keys would be okay.

0 Likes 0 ·
brendan avatar image brendan chris-3 commented ·

Different keys are indeed distinct. What's the complete body of the error response you're getting? A 409 Conflict is most commonly caused by multiple simultaneous calls that act upon the same data, but depending on the specifics of your use case, it could be other things. How often do you write to player internal data? How large is the data? How many keys are you writing to? Also, it sounds like you're saying that you are, in fact, firing off multiple calls in rapid succession, with each writing to different data. Why can't that be aggregated into a single call?

0 Likes 0 ·
chris-3 avatar image
chris-3 answered

{

                "Level": "Error",
                "Message": "PlayFab API request error",
                "Data": {
                    "api": "/Server/UpdateUserInternalData",
                    "request": {
                        "PlayFabId": "5CD4B1B11633C994",
                        "Data": {
                            "LoginRewardsStatus": "[{\"ID\":\"DefaultD30\",\"Calendar\":0,\"Day\":0,\"ShowDate\":\"0\",\"StartDate\":\"1542326400000\",\"EndDate\":\"0\",\"LastClaim\":\"1542240000000\"},{\"ID\":\"DefaultD7\",\"Calendar\":0,\"Day\":0,\"ShowDate\":\"0\",\"StartDate\":\"1542326400000\",\"EndDate\":\"0\",\"LastClaim\":\"1542240000000\"},{\"ID\":\"WelcomeD7\",\"Calendar\":0,\"Day\":0,\"ShowDate\":\"0\",\"StartDate\":\"1542326400000\",\"EndDate\":\"0\",\"LastClaim\So ":\"1542240000000\"},{\"ID\":\"PiratesD7\",\"Calendar\":1,\"Day\":0,\"ShowDate\":\"1541116800000\",\"StartDate\":\"1542326400000\",\"EndDate\":\"1543708800000\",\"LastClaim\":\"1540944000000\"}]"
                        }
                    },
                    "result": null,
                    "apiError": {
                        "code": 409,
                        "status": "Conflict",
                        "error": "A conflict occurred trying to make multiple edits to the same data at the same time. This often indicates that there are multiple concurrent requests to the same API for the same player",
                        "errorCode": 1133,
                        "errorMessage": "A conflict occurred trying to make multiple edits to the same data at the same time. This often indicates that there are multiple concurrent requests to the same API for the same player",
                        "errorHash": "0073b409daf6c9bc223607647f3be421",
                        "errorDetails": {
                            "RequestID": [
                                "1-5bef05cb-85db2e34db061b2e18f4f08c"
                            ]
                        }
                    }
                }
            }
        ],

------
This is a new account and this is the first time this data is created.

It reads and internalTitleData to create this variable.
Just before this, a seekers and adwatchcontrol internalUserData created just fine.

It was/is the only attempt to access/write LoginRewardStatus for this player.
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.

chris-3 avatar image chris-3 commented ·

The timing of the calls is by the client and where the user goes normally. In this case it's because he need and the various system are being set up. The actual data written is determined by cloudscript.

0 Likes 0 ·
brendan avatar image brendan chris-3 commented ·

Reviewing one of the players that most recently ran into this, what we're seeing is that you're calling a series of Cloud Script handlers from the client, but without waiting on them to respond - given the timestamps, there are between 8 and 9 handlers you're calling all at once. What you need to do is serialize these, so that you don't make a Cloud Script call until the previous one has completed for the player.

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.