question

Kain avatar image
Kain asked

UpdateCharacterStatistics internalservererror

We are currently debugging an issue that happens in one of our functions.

An excerpt from event logs shows this:
"cloudScriptErrorCode": "InternalServerError",

    "stack": "Error\n    at Object.server_request (Script Document:161:24)\n    at Object.server.UpdateCharacterStatistics (Script Document:617:82)\n    at HandleMissionConclusion

I am unable to dig any deeper than this, but this issue seems intermittent and does not happen 100% of the time.

Is there any way to dig deeper into this to figure out the error at Object.server.UpdateCharacterStatistics (Script Document:617:82)?

4 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.

Seth Du avatar image Seth Du ♦ commented ·

Can you provide your title ID, corresponding Player ID and character ID, as long as sample codes?

0 Likes 0 ·
Kain avatar image Kain Seth Du ♦ commented ·

titleID is EC18

We are unable to obtain character and player ID from our event logs for these incidents, but here is a recent json associated with the exception that we caught and throw into an error event:

{

  "PlayFabEnvironment": {
    "Application": "mainservercloudscriptint",
    "Vertical": "master",
    "Commit": "552dfe0",
    "Cloud": "main"
  },
  "EventNamespace": "title.EC18",
  "EntityType": "title",
  "SourceType": "GameServer",
  "EventName": "QtnCloudScriptError",
  "Timestamp": "2019-09-10T07:58:33.6229721Z",
  "EntityId": "EC18",
  "EventId": "a46069d22aa5416eb098e17b8fac2136",
  "Source": "EC18",
  "WhatError": {
    "cloudScriptErrorCode": "InternalServerError",
    "stack": "Error\n    at Object.server_request (Script Document:161:24)\n    at Object.server.UpdateCharacterStatistics (Script Document:617:82)\n    at HandleMissionConclusion (EC18-main.js:318:10)\n    at "
  }
}
0 Likes 0 ·
Kain avatar image Kain Seth Du ♦ commented ·

An exerpt of the call to UpdateCharacterStatistics that intermittently fails looks like this:

	const xpCap = parseFloat(xpSettings.XPCap);
	const oldXP = characterStats[KEYExperience] || 0;
	let newXP = oldXP + xpToGrant;
	if (newXP > xpCap) {
		newXP = xpCap;
	}


	let snacksFromXP = 0;
	if (isMissionSuccess) {
		let missionSuccesses = parseFloat(characterStats.MissionSuccesses) || 0;
		missionSuccesses += 1;
		server.UpdateCharacterStatistics
			({
				PlayFabId: currentPlayerId,
				CharacterId: characterID,
				CharacterStatistics: { MissionSuccesses: missionSuccesses, Experience: newXP }
			});
0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Seth Du ♦ commented ·

There are few possible causes but I believe what you should do is to set a variable that will get the callbacks from UpdateCharacterStatistics, even a failed callback result will generate a detailed error report, which will help you debug this issue.

0 Likes 0 ·

1 Answer

·
Kain avatar image
Kain answered

This is now suddenly happening prolifically amongst our users for the last week or so.
Our calls to "server.UpdateCharacterStatistics" seem to result in an internal timeout error response from PlayFab.

Specifically,

server.UpdateCharacterStatistics with only two values results in

"PlayFab API request failure" -> "Timeout"

We placed a try-catch block around the function that makes that call to return a detailed error report of any failures, as @SethDu suggested.

Logs from the failed mission show this relevant portion

[2020.03.25-21.42.52:090][450]LogQtn: [QtnPlayFabSessionArchetype_C_0] OnSuccessExecuteQtnMissionConclusionEvent: Log during CloudScript execution: {"Level":"Error","Message":"PlayFab API request failure","Data":{"api":"/Server/UpdateCharacterStatistics","request":{"PlayFabId":"87CAE27938F0E9E","CharacterId":"2E92FECC1C5E3D41","CharacterStatistics":{"MissionSuccesses":390,"Experience":86242}},"error":"Timeout"}}


[2020.03.25-21.42.52:090][450]LogQtn: [QtnPlayFabSessionArchetype_C_0] OnSuccessExecuteQtnMissionConclusionEvent: Log during CloudScript execution: {"Level":"Info","Message":"{\"cloudScriptErrorCode\":\"InternalServerError\",\"stack\":\"Error\\n    at Object.server_request (Script:161:24)\\n    at Object.server.UpdateCharacterStatistics (Script:622:82)\\n    at HandleMissionConclusion (EC18-main.js:353:10)\\n    at handlers.QtnHandleMissionEvent (EC18-main.js:783:28)\\n    at Object.invokeFunction (Script:116:33)\"}"}

Any idea why our calls to 'server.UpdateCharacterStatistics' would intermittently timeout?
Is there anything we can do on our side to prevent this timeout from happening?

Might this be an issue to be resolved on the PlayFab side?

1 comment
10 |1200

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

Kain avatar image Kain commented ·

ok, for anyone else who stumbles across this issue, we employed a bandaid solution of putting that single call to server.UpdateCharacterStatistics inside a try-catch block and then doing some recovery stuff that does not involve 'server.UpdateCharacterStatistics' inside the catch block.

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.