question

Ben avatar image
Ben asked

Request timeout

I've been trying to track down a bug with our game for a while now, but I've hit a wall. We rely on the resolution of a PlayFab login before we finish our startup initialization. One of the things we use PlayFab for is storing some configuration in the title data, so knowing if we're logged in and that we can access that data is critical.

My problem is that some of the requests to PlayFab are taking a confusing amount of time (40+ seconds). Primarily the login request, since that's what blocks the initialization of the game, but I have also noticed it on some cloudscript execution requests. We added our own "Timeout" which is just a co-routine that retries the request after ~20 seconds, which reduced the number of tickets we received. However, many users fail 3+ times without a single response from the API.

Where would you suggest that I go from here?


I would assume it's a timeout issue, but other questions on the forums state that the timeout is 2.5 seconds, which would be greatly exceeded here. Could it be the PlayFab `RequestKeepAlive` setting keeping the request from timing out, but then the request still taking over a minute to reply?

We're using unity 2018.3.14f1, with the PlayFab sdk 2.75.191001, our TitleID is 713F0


Our PlayFab settings are configured to use:
`RequestType: UnityWebRequest`,
`RequestTimeout: 2000`,
`RequestKeepAlive: true`,
`CompressApiData: true`

Frustratingly I cannot recreate this delay on my own machine, it only happens to users while on mobile devices. It doesn't seem specific to Android or iOS as I get user reports for both. We include unity's NetworkReachability in the support ticket, and devices are reporting `ReachableViaLocalAreaNetwork` and `ReachableViaCarrierDataNetwork`


Any help is greatly appreciated, thanks in advance!

apisCloudScriptsupport
10 |1200

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

Citrus Yan avatar image
Citrus Yan answered

Hi @Ben,

>>Where would you suggest that I go from here?

You are saying that the requests to PlayFab takes a confusing amount of time (40 + seconds), do you mean that PlayFab responded properly (without raising TimeOut error) although it took about 40 + seconds? If that’s the case, as I see it, 40+ seconds greatly exceeds the Time Out (2s based on your configuration). I think you should utilize network capture tools such as fiddler to help track the network traffic to see whether it actually took 40+ seconds for the responses to reach the Client.

>>…Could it be the PlayFab `RequestKeepAlive` setting keeping the request from timing out, but then the request still taking over a minute to reply?

No, I don’t think so. According to this code, RequestKeepAlive refers to the Keep-Alive Http general header, which allows the sender to hint about how the connection may be used to set a timeout and a maximum amount of requests. Therefore, it’s unlikely that PlayFab `RequestKeepAlive` setting keeping the request from timing out while the request still taking over a minute to reply.

By the way, I looked into your title’s API CALLs from the Title Overview page, the results of login calls seem alright though. You may need to add more loggings in the client-side to help identify the issue.

10 |1200

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

Ben avatar image
Ben answered

Thank you @Citrus Yan for your quick response!


Unfortunately I haven't been able to reproduce the issue on any of my devices, so I think it's unlikely that a network capture tool such as fiddler will help me identify the issue. Though it's certainly something I'll look into!


I plan on releasing a new build with some additional logging. Mainly by setting EnableRequestTimes to true, and logging the output to console as well. I had read that this is not the best to have running in production, but it feels like a necessary evil at this point.

I'm hoping that this gives me enough extra information that I can resolve the issue, as I continue to get support tickets on a daily basis.

As a side note, I have noticed that the issues are more prominent when trying to log in using a DeviceID instead of a social backend such as GameCenter or GPGS.



Another question that you might be able to answer for me is the impact of multiple login calls?

In out current setup we make a login request, and if in 20 seconds the request has not returned we make another attempt. However if the first request returns after that time we discard it, regardless of the result. This is done by sending a generated id as custom data with the request.

Would there be a negative impact to accepting a successful request for login despite having potentially already sent additional requests?

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.

Citrus Yan avatar image Citrus Yan commented ·

Hi @Ben

Not really, technically speaking, login calls are just a way of authenticating players so that they can make subsequent API calls. The players can make subsequent calls as long as they have one of the SessionTicket received from those login calls, making multiple login calls won't affect much.

0 Likes 0 ·
andrestallos avatar image
andrestallos answered

Hello! We seem to be having a similar problem. In particular, we seem to be having no response on the LoginWithIOSDeviceID call. We have seen a few cases, always on iPad devices (not on iPhone on in Android devices with LoginWithAndroidDeviceID). Unfortunately one of those devices is used by Apple for their review process, so we’ve had several rejections now because the device fails to create an account and gets stuck waiting for an answer. We are not 100% sure if it fails consistently with those devices or only occasionally, because we haven’t seem them try multiple times (since this happens on their very first session, it isn’t odd that they don’t come back). Unfortunately we haven’t been able to reproduce the problem on our own test devices.

We are certain that the call reaches the server, because the account is created, leaving the usual traces in the player's Event History. However, we are also quite certain that device doesn’t receive a response from the server, because Apple sends a screenshot of the state in which the game waits too long, and we’ve set it up to show a different message in each step of the login flow, including right before and after the Playfab call.

We are using Unity 2019.2.9f1 and version 2.76.191015 of the Playfab SDK. The other main plugins are Firebase, Photon and Adjust. Our Playfab settings use Unity Web Request, Request Timeout: 2000, Keep Alive: True, Compress API Data: True. Our TitleId is AE2C. We can send the playerId of specific cases we've found of accounts having this error.

Is there anything we could do to try to get around this, or to debug it further? We think we may have had this error occasionally before, but it seems to have become more frequent now. It is preventing us from getting new updates approved by Apple, so it's a serious blocker at the moment. Any help would be really appreciated!

10 |1200

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

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.