Sleeping Test Server

I really can’t think of a better name for this. When using Test>Server>1 Player, if you are focused on the Client Window, after a certain amount of Time, the Server Falls asleep or stops looking for Remote Events/Functions calls from the Clients.

Repro Video:

Repro Place: Sleeping Server - Roblox

--Server:
game.ReplicatedStorage.RE.OnServerEvent:connect(function(player,org,dest)
	local B = game.ReplicatedStorage.Bullet:Clone()
	B.CFrame = org
	B.BV.velocity = (dest-B.Position).unit*80
	B.Parent = workspace
	wait(2)
	local con
	con = B.Touched:connect(function(hit)
		con:disconnect()
		con = nil
		B:Destroy()
	end)
	wait(10)
	pcall(function()
		B:Destroy()
		con:disconnect()
		con = nil
	end)
end)

--Client
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.Button1Down:connect(function()
	game.ReplicatedStorage.RE:FireServer(game.Players.LocalPlayer.Character.Head.CFrame,mouse.Hit.p)
end)

Repro Steps:

  1. Open the Place in Studio and Test>Server>1 Player
  2. From the Client Window, just click around on the Screen to shoot White Parts from your Head.
  3. keep doing Step 2 for about 1 to 2 minutes
  4. at some point the Parts will stop being created from your characters Head
  5. When Step 4 happens, keep clicking around your character (about 10-20 times)
  6. Click anywhere outside the Client (so that the Studio Client Window is not focused)
  7. Noticed that the server finally gets the message and fires all of the Parts at once (as seen in the video)
  8. Click on the Studio Server Window
  9. Return to the Studio Client Window
  10. do Step 2 and noticed the Parts fire again correctly, until Step 4 happens again.

Basically clicking on the Studio Server Window, makes the Server wake up, and then after 1-2 minutes of the Server Window not being the focus the Server goes back to sleep.

I think this started happening after the recent Update (that occurred Last night?), or it started happening after I upgraded my OS for Mac from Maverick to Yosemite.

I’m on a MacBook Pro (Retina, 15-inch, Early 2013), running on OS X Yosemite

This gets very annoying when trying to test stuff, since at some point the Server just stops processing requests from the Client and I think that my Code is to Blame, when it’s not :confused:

This appears to be a Mac OS feature. We’ll investigate if we can disable automatically, but for now, the only way around it is to enter the following into the Mac terminal:

defaults write NSGlobalDomain NSAppSleepDisabled -bool YES

This will cause non-focus winodws to not be put to sleep by the OS. However, this may reduce battery life for Macs. To re-enable this feature when you’re done with it, enter the following into the Mac terminal:

defaults write NSGlobalDomain NSAppSleepDisabled -bool NO

Be aware that this won’t apply until the program has been restarted. This will apply to all apps once the OS has been restarted.

Did you find a way to do this automatically :D! I haven’t run into this problem since last update, It’s much appreciated!

Yes! This issue was fixed. Glad we could help!