question

esenkleiter avatar image
esenkleiter asked

PlayFabServerAPI GetTitleInternalDataAsync Duplicate Key Error

Hello,

we. get the following Exception while testing nearly simultaneous access to title data.

Object reference not set to an instance of an object.

We assume this may be a thread bug here. We call the PlayFabServerAPI from a local azure function, to get some tile data. Thanks for your help.

The corresponding stack trace:

at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)\n   

at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)\n   

at PlayFab.PluginManager.GetPluginInternal(PluginContract contract, String instanceName)\n   

at PlayFab.PluginManager.GetPlugin[T](PluginContract contract, String instanceName)\n   

at PlayFab.Internal.PlayFabHttp._DoPost(String fullPath, PlayFabRequestCommon request, String authType, String authKey, Dictionary`2 extraHeaders, PlayFabApiSettings instanceSettings)\n   

at PlayFab.Internal.PlayFabHttp.DoPost(String urlPath, PlayFabRequestCommon request, String authType, String authKey, Dictionary`2 extraHeaders, PlayFabApiSettings instanceSettings)\n   

at PlayFab.PlayFabServerAPI.GetTitleInternalDataAsync(GetTitleDataRequest request, Object customData, Dictionary`2 extraHeaders)\n   

at GoGBackend.Controller.MiniGameController.GetMiniGames()
apisTitle Data
7 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.

Citrus Yan avatar image Citrus Yan commented ·

May I have the code snippet that reproduces this issue? Please also specify the version of the PlayFab SDK you're using.

0 Likes 0 ·
esenkleiter avatar image esenkleiter commented ·

NuGet- PlayFabAllSDK 1.80.200901

var playerTitleData = await PlayFabServerAPI.GetTitleInternalDataAsync(new GetTitleDataRequest
            {
                Keys = new List<string>
                {
                    "miniGameCollection"
                }
            });

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan esenkleiter commented ·

I was not able to reproduce this error using PlayFabAllSDK 1.80.200901 in my FunctionApp project, could you please provide a complete reproduce steps so that I can investigate further?

0 Likes 0 ·
esenkleiter avatar image esenkleiter commented ·

Well we're using the ExecuteFunction script for executing the function locally. Furthermore we make two parallel calls to our "local" azure function. The exception is not always thrown. It seems to be a tricky thread-bug. The PlayFabServerAPI is generally thread safe, right?

0 Likes 0 ·
esenkleiter avatar image esenkleiter commented ·

Maybe you have a great solution for not accessing the title data on every azure function call. We thought about a static var holding the data, but what about updating this static var.. Do you have a best practice here for accessing Title Data in Azure Functions?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan esenkleiter commented ·

Yes, they're generally thread safe, and, I also tried using the ExecuteFunction script for executing the function locally and make nearly simultaneous requests to the local Function app, however, I cannot reproduce the same issue:(

Looking at the stack track you provided, looks like the error happened at:

PlayFab.PluginManager.GetPluginInternal(PluginContract contract,String instanceName)

Have you find anything regarding this issue?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan esenkleiter commented ·

And, accessing Title Data per request won't be a problem as it was designed as Global Constant/Static Data.

0 Likes 0 ·

0 Answers

·

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.