BindToClose 100% Infinite Yield


#1

As of two hours ago I have been getting:
image

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:

  1. Make baseplate
  2. make server script, insert following code:
local dss = game:GetService("DataStoreService")

local ds = dss:GetDataStore("ds")

game:BindToClose(function()
	ds:SetAsync("akey", {})
end)
  1. Publish place and enable studio access to API services.
  2. Play solo, Stop.
  3. image

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)

BindToCloseSetAsync Repo.rbxl (12.5 KB)

NOTICE:
This happens with any yield, change the SetAsync to wait() and the results are the same.


OrderedDataStore yields infinitely when closing a game
~30 second delay after running game in studio
Accurate Play Solo BindToClose DataStore doesn't save
FireClient not triggering through a PlayerRemoving event?
Saving data to Datastore taking a long time on Studio test
BindToClose extended yield w/ coroutine.yield()
SetAsync stopping script indefinitely
XP System DataStore
Warning regarding GameAnalytics SDK
#2

I’m going to publish this test on a live server. If it doesn’t save my data, I’d regard this as ROBLOXCRITICAL.


#3

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.


#4

I can’t even open your rbxl file, every time I do Studio crashes (separate issue).


#5

Opens fine for me. It’s a baseplate with 1 server script with the code supplied in step 2


#6

Just tested, this is only in Studio thankfully.


#7

How did you confirm?


#8

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.


#9

Probably related to this issue I was having while testing Accurate Play Solo a couple of weeks ago :arrow_right: Calling YieldFunctions from BindToClose functions hangs Studio after clicking Stop button


#10

Still an issue that is halting proper development.


#11

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.


#12

Can confirm I’m having this issue too


#13

This needs to get fixed, absolutely destroying dev time


#14

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.


#15

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.

Still, annoying.


#16

Lol, ‘just comment it out’ well where is the over complexity in that?
I swear, sometimes the obvious escapes me :stuck_out_tongue:


#17

I’m having the same exact issue.

My datastore code literally hangs studio with BindToClose for 30+ seconds, sometimes even crashing it.
image

The other night this caused studio to actually EAT all my RAM when studio crashed.


Please excuse my custom windows theme

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.


#18

I can confirm this happens with ALL yields. Simply a wait() will crash the BindToClose. @Fm_Trick, you may want to change the title accordingly.


#19

It appears this is affecting more and more people daily… (?) Would be good to get some staff input.


#20

Can confirm it’s been affecting me as well and was stumped for a while what was causing it this week.