every time I press stop from play solo in studio if there is a DataStore:SetAsync called binded to game:BindToClose()
This is reproducible and here is how:
Make baseplate
make server script, insert following code:
local dss = game:GetService("DataStoreService")
local ds = dss:GetDataStore("ds")
game:BindToClose(function()
ds:SetAsync("akey", {})
end)
Publish place and enable studio access to API services.
Play solo, Stop.
This is slowing down my work immensely right now as I am working with things save-load reliantā¦
It is interesting to note that the data DOES save, SetAsync just seems to yield infinitelyā¦
This started after the latest studio update tonight.
I donāt know if this is happening in live places, or only studio. I would consider this ROBLOXCRITICAL if it is happening in live games (as i fear it is)
It is saving my data, but I am only one person. If i were attempting to save a whole serverās playersā data, it would only save the first one as it yields on the first SetAsync.
I made a test place that saved 3 keys of data and read them back to me next visit in a BindToClose. In Studio, it saved the first and infinite yielded. On the site, it read all the data back to me next time I joined.
This has been happening to me too and it is slowing me down SO MUCH. Some people in my testing server also lost all of their data (even though i kick them from the game if theres an error loading their data and dispose their data object) last night about 3:30 am during the outage.
If it is not critical for you to have the data saved, while this bug is not fixed, and you want to bypass the yeilds in your BindToClose function, at the beginning of your script, set a variable local IsStudio = game:GetService(āRunServiceā):IsStudio()
Then in your BindToClose, just check if not IsStudio then --have your yeilds in here
Its just a temporary thing I am doing just to be able to work on my project without going insane.
Or just comment it out. However that is a workaround, we need a fix for this.
Alternatively, I have a temporary button in my StarterGui that lets me call my datastore functions on click, so I can disable my BindToClose and still save my data.
The code in question that causes the 30+ second hang:
game:BindToClose(function()
while #PlayerData_Folder:GetChildren()>0 do
PlayerData_Folder.ChildRemoved:wait()
end
end)
And yes, ALL children of PlayerData_Folder are removed upon server shutdown, so it isnāt a mistake in my code causing this.
How to reproduce the bug:
Literally just press F5 to do a play solo session, have some `BindToClose` function that waits for all children of a data folder to be removed / all data to be written to datastores and studio will hang.
I also noticed that if you press F5, then press Shift+F5 within less than a second, studio will almost always crash. Why do I do this? Sometimes I see an obvious mistake in my code but I just pressed F5, so I quickly press shift+F5 to end the play solo session.
This has been an issue for months for me, and itās really impacting development.
Please fix this as soon as possible, Iām literally jumping through hoops around BindToClose while in studio to avoid this hang and potential crash.