Sign In Register

How can we help you today?

Start a new topic

getPrivate after setPrivate

Hello,


We came across strange behavior of getPrivateData setPrivateData, here is an example:

time: description

-------------------------

t01: initSetData -> use setPrivateData to save data to challenge session (saves dataV1)

t02: scriptGetData -> use getPrivateData to get data from challenge session (correct dataV1)

t10: scriptProcessData -> use getPrivateData to get data from challenge session for processing (correct dataV1),

                                       process dataV1 -> data and use setPrivateData to save data to challenge session (saves dataV2)

t11: scriptUseData -> use getPrivateData to get data from challenge session (correct dataV2)

t12: scriptGetData -> use getPrivateData to get data from challenge session (correct dataV2)

t20: scriptProcessData -> use getPrivateData to get data from challenge session for processing (INCORRECT, gives  dataV1),

                                       process (incorrect) data and use setPrivateData to save data to challenge session. (saves dataV2)

t21: scriptUseData -> use getPrivateData to get data from challenge session (correct dataV2)

t22: scriptGetData -> use getPrivateData to get data from challenge session (correct dataV2)

t30: scriptProcessData -> use getPrivateData to get data from challenge session for processing (correct, gives  dataV2),

                                       process data and use setPrivateData to save data to challenge session. (saves dataV3)

t31: scriptUseData -> use getPrivateData to get data from challenge session (correct dataV3)

t32: scriptGetData -> use getPrivateData to get data from challenge session (correct dataV3)

t40: scriptProcessData -> use getPrivateData to get data from challenge session for processing (correct, gives  dataV3),

                                       process data and use setPrivateData to save data to challenge session. (saves dataV4)

t51: scriptUseData -> use getPrivateData to get data from challenge session (correct dataV4)

t52: scriptGetData -> use getPrivateData to get data from challenge session (correct dataV4)

t50: scriptProcessData -> use getPrivateData to get data from challenge session for processing (INCORRECT, gives  dataV2),

                                       process data and use setPrivateData to save data to challenge session. (saves dataV3)

...

---------------

This behavior is intermittent, rarely scriptProcessData drives data to final V(version) progressing from V1-Vx(final data version) in order. But more often scriptProcessData  gets incorrect version of data so for example, it drives data in order V1-V2-V3-V4-V2-V3-V2---Vx.


It looks like some kind of cached or outdates version of data is returned to scriptProcessData and that in time scriptProcessData eventually beats the cache, but this is just an assumption. 


Any idea why is this happening?




Hi Milutin,


Investigating.

Is this still happening?

Can you give us the steps used to reproduce?


Thanks,


Oisin

Hi Oisin,

As temporary solution we replaced setPrivateData with solution that passes data directly between scripts and same code logic works fine now. For us this is clear sign that there is something going on with get\setPrivateData. However, in the end we will need data saved with set/getPrivateData. We used setPrivateData on challanges. We did not test since with get/setPrivateData but if you changed something on server side we will change code and test again, shell we test with setPrivateData now?

Simple example to reproduce would be for example:

challengeStartedMessage calls initSetData.

initSetData: set counter c to n. save it with setPrivateData to challenge and schedule execution of scriptGetData (with passed challenge id) in 2 seconds.

scriptGetData: get challenge and getScriptData for c, check value of c and send it to challenge players, schedule execution of scriptProcessData (with passed challenge id) in 5 seconds.

scriptProcessData: get challenge and getScriptData for c, c--, if c != 0 use setPrivateData for c and schedule execution of scriptGetData (with passed challenge id) in 5 seconds, else if c == 0 stop.

In our code we use get/setScriptData for more complex json structure instead of only counter c and we have more scripts executed, one after another, until scriptProcessData.

Was there an issue with backend and should we test again with set/getPrivateData?

Thanks


I cant find option to edit previous post, but everywhere instead of [get/set]ScriptData  should be [get/set]PrivateData. 

Any comments about this topic? 

Hi Milutin,


I am trying to replicate this behavior myself but have been unable to reproduce the bug. 


Can you describe a bit more on how you are using the scheduler and how your challenge interacts with the Cloud Code?


Can you test one more time to confirm the bug is still happening?


Thanks,


-Pádraig

Hello Pádraig,


We'll change the code again to use setPrivateData and test. If we have described problems again we will describe in more details how to reproduce. 


Thanks

Login to post a comment