How often are you pinging get/set? Are you 100% sure they aren’t being throttled?
Should be within limitations - we autosave everyone’s data every 10 min (w/X second delay, I think 5-10 seconds) between calls - if it errors it waits longer before moving to the next person). Get only calls on joining the game.
Data saves when leaving the game + auto save. Get fires when joining (and gives 10 attempts w/delay inbetween if last call errored). Get also checks the budget for getasync and if it’s 0, it waits until it’s not 0/the 10 attempt queue is exhausted.
Edit: Roughsphereblox is a life saver - ends up if the call to getasync is successful or fails/throttles, the result is cached for 4s. I knew it was cached for successful requests, but didn’t realize it applied to throttled/errored requests too. Thank you!!!
For the past week, I’ve been having over 10 people coming to me due to their data completely being wiped from in-game, no clue what’s going on with it, but hope it gets fixed soon.
Can confirm this, have had a lot of people reporting data loss lately when I never had any reports about it before.
There’s no new errors in my logs and players who lost their data can play the game just fine, which shouldn’t work if there was an error loading it. They also seem to get my tutorial popups again which only happens after joining without data, so it’s as if their data has been wiped completely internally.
Traitor Town has it too. I’ve had to close the game because of this.
Heads up, after talking to the amazing @RoughSphereBlox (Seriously, you’re the real MVP here), this was the issue with Vehicle Simulator’s data code (But likely applies to other games too that try repeated attempts to load data):
If you make a call to getasync, it caches for 4s (Per the wiki documentation). If the request throttles/errors, and another request is made within that 4s period, getasync will return nil w/o erroring (Because nil was what was cached).
Due to holiday traffic, this bug never reared its head for us (Because we only had two calls to getasync when a player joined the game).
Our game (When a player joins) would try 10x to load the data (In succession w/a delay of 1s if data failed to load). If the data failed to load the 1st time (Due to throttling/errors), it’d wait 1s and try again. Being that it was within that 4s cooldown period, it would return nil w/o throwing an error (Because technically it was a cached result).
RoughSphereBlox/the engineers recommend using an exponential delay with trying to call getasync (If it errors/throttles).
1st attempt fails, wait 6s.
2nd attempt fails, wait 12s.
3rd attempt fails, wait 18s.
tl;dr: Calling getasync within 4s of calling getasync (If it successfully runs/errors/throttles) returns the cached value, even if it’s nil because of an error/throttle.
Edit: This is speculation at this point, need a roblox engineer to verify if this is the case or not.
Details on DataStoreService for Advanced Developers
The holidays always seem to be when the bugs start appearing en masse. Thanks for posting this solution so others can apply this as well.
Was there any reason specified as to why an exponential delay was recommended? I’m kind of iffy on doing this. I completely support whatever it takes to ensure players receive their data, but keeping them waiting is another thing. Both waiting a long time and losing data are undesirable and can hamper the patience of players (especially within a young demographic), resulting in loss of players and consequently revenue.
RoughSphereBlox recommended it after conversing internally w/staff. Likely need the exponential delay if there’s issues loading data and you want to retry loading in succession.
Currently my data system attempts to re-load a player’s data if
GetAsync() fails. I’ll have to disable the load retries until caching is removed.
I personally can’t stand not doing this, but you do run into that potential issue of sending to many requests, so be very weary of using HTTPService for saving data, perhaps save data when the game closes, and load it on the game start.
This seems like a really strange, and potentially dangerous, edge-case. Is this intentional or a bug?
Wouldn’t it make more sense for it to error again, instead of returning nil when there’s no successfully cached data?
Not sure if intentional or bug (I imagine a bug)? Would love to see roblox engineer’s input on this.
If GetAsync caching is the problem… Just throw it out the window and use UpdateAsync to grab data since it returns latest data and doesn’t cache. Furthermore, it suits the usecase of most developers better because if they use UpdateAsync to store data, when players hop servers the call to grab data will respect the queue of data saves in the last session.
Just to be clear, UpdateAsync has a callback function that gets fed the argument of an old value, but UpdateAsync itself returns the newest value after it finishes.
PS: You don’t want to use SetAsync to save player profiles to begin with + UpdateAsync can be used to create player profile handling code that can be updated during playtime.
The very least, I hope this can be a temporary solution to our problems.
Would you mind posting this as a reply on this thread for visibility until it is addressed? I would add it to the OP, but sadly I am right at the character limit:
I have moved this to Engine Bugs for visibility.
YES. This has happened to multiple of my users on the 3rd of January and apparently once more since. I haven’t changed my datastore code and I’ve never experienced full data loss like this.
I’ll try what Belzebass said about not requesting data too quick if it fails, but getting a false return of datastore being nil should never be possible
pcall(function() local data = DataStore:UpdateAsync("key", function(old_value) return old_value end) end)
@Belzebass Do you have reproduction steps or at least an example of the type of throttling/error for which this happens?
Swordburst 2 started getting a lot of reports of data loss as of Friday (and they stopped after this). We hadn’t updated the game within 2 days prior to the influx of reports.
Our developer console in-game has a couple warnings of throttling, yet our DataStore budget tab shows our budget is at 570+, so why are we being throttled?
I believe Royale High switched to using custom datastores due to data loss issues as well. It seems to be more prevalent in games with teleportservice.
No repo, dev relations looked and said that (In their experience) that it was the most likely the case.