question

Ross Klettke avatar image
Ross Klettke asked

possible quickStart bugs,possible tutorial bugs

Overall the documentation for PlayFab has been fantastic but I'm having a bit of trouble with the File Upload tut for the new-ish Entity system

Entities QuickStart Tut

Specifically, I think there might be an extra GlobalFileLock -= 1 in the OnInitFailed method at the end of the line that begins with PlayFabDataAPI.AbortFileUploads...

  • It's commented as Finish AbortFileUploads but executes before we'd know whether that was the case.
  • If we end up trying to abort an upload, then whether the Abort is successful *or* unsuccessful, it leaves GlobalFileLock at -1

Possibly another issue:

Within the OnInitFileUpload method -- if the SimplePutCall fails, it seems to leave the GlobalFileLock at 1.

Please let me know if I'm correct in thinking this or overlooking something.

And, being fairly new to reading/writing data in this way, I'd be very interested in some expansion on the included note in that article:

"Each file action requires many steps and multiple API calls, so don't try to access the same file in multiple ways at the same time. If you are very careful, you might not need a locking mechanism. If you want to do something complicated, your locking mechanism may be much more complex."

Thanks!

--Ross

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.

Ross Klettke avatar image Ross Klettke commented ·

Apologies about the double-post -- unable to find an "edit" button to correct it

0 Likes 0 ·

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

As I see it, every "GlobalFileLock -= 1" statement matches with a "GlobalFileLock += 1" statement, and, I was not able to reproduce the cases you discussed above. Would you please share some steps to reproduce the them?

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.

Ross Klettke avatar image Ross Klettke commented ·

For some reason the previous link got garbled -- here's the Entities QuickStart Tut that I'm working off of.

I'm under the assumption that at the end of the upload attempt, we want the GlobalFileLock to be at 0 -- whether the operation was successful or failed.

Of the two issues brought up in my initial post, the first occurs when the PlayFabDataAPI.InitiateFileUploads call fails and subsequently calls OnInitFailed. There, if the error is EntityFileOperationPending, whether the following PlayFabDataAPI.AbortFileUploads call is successful or unsuccessful -- the GlobalFileLock is left at -1.

---> I believe this is all caused by mistakenly decrementing GlobalFileLock at the far right of the same line of code as PlayFabDataAPI.AbortFileUploads...

-- note that it is actually outside of the AbortFileUploads call and, as stated before, it is commented as "Finish AbortFileUploads" -- even though that operation would not have completed at that moment.

The second issue with GlobalFileLock ending up at 1:

caused by a SimplePutCall failing

At this point, I've tested both, and seem to have confirmed their occurrence

Thanks!

--Ross

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Ross Klettke commented ·

Hi, we managed to reproduce those two issues you stated above.

Deleting "GlobalFileLock -= 1;" at the end of the line of PlayFabDataAPI.AbortFileUploads would fix issue 1.

Adding "GlobalFileLock -= 1;" in the error callback of PlayFabHttp.SimplePutCall would fix issue 2.

1 Like 1 ·

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.