For the past 8 hours or so, I’ve been banging my head against a wall trying to trace a bug in a datasystem that I’m working on, and I can’t seem to be able to trace it for the life of me.
My data system saves data to datastores when a player leaves the game. If that save fails, it will retry
n more times until it either succeeds or
MAX_RETRIES is hit, in which case it will stop attempting to save the player’s data. The data is stored in a folder/ValueObject format to allow for easy replication from server -> client and to allow for easy debugging in studio.
I have a
BindToClose function that basically waits until there are 0 data folders in the data cache folder. Since a cached datafolder is destroyed when the player leaves and after the save operation completes, 0 folders = all player data has been saved, thus the server can shut down safely.
I’ve gone over my code over and over, testing it in literally any way I can think of and my code seems to check out each time…yet when I end a test session, I get the error
Not running script because past shutdown deadline .
When the data is saved successfully the first try, the logic works perfectly fine and
BindToClose works as expected. However, if the data save fails and the retry operations run,
BindToClose seems to just…hang.
The code is in
ServerScriptService.Services.DataService and the data cache folder is located in
You can toggle the simulated datastore errors by opening
ServerScriptService.Utils.MockDatastoreService.MockDatastoreService.MockDatastoreConstants and setting
My older data-system’s code is almost identical and does the same thing, yet it works perfectly fine so I can’t tell if there’s some really obscure bug here in my code or if it’s
BindToClose being funky, as there’s a known bug regarding it.
The same issue occurs when using the regular datastore API too, so it’s not the datastore lib I’m using by process of elimination.
Repro place file : DataSystem_Bug.rbxl (186.0 KB)
Could a kind soul point out if this is an issue with my code, or if it’s related to the aforementioned bug with
BindToClose? I can’t seem to be able to find any problems with my code, regardless of how many different tests I throw at it.