Roblox fails with closing connections on test end

Describe the bug. Describe what is happening when the bug occurs. Describe what you would normally expect to occur.

Browser usually limits opened connections at one time to 6 - 8. Roblox Studio (and maybe Roblox engine also) does tha same. What does it exactly mean? Roblox engine can continue only 8 connections at one time. New need to wait until previous get closed (get response) and this is good behavior.

However Roblox Studio should close the pending connections when test is stopped. Instead it attempts to continue them in some background queue. If you’ve got a polling server (which sends response after eg. 10 seconds) you can run 5 * 400 requests in 5 tests. At the last test you won’t get any response until these from previous tests are completed.

How often does the bug happen (Everytime/sometimes/rarely)? What are the steps that reproduce the bug? Please list them in very high detail. Provide simple example places that exhibit the bug and provide description of what you believe should be the behavior.

The way to reproduce it is running a server and a studio and it happens always. Here are scripts to do that.

NodeJS Server

var apiServer = http.createServer((req, res) => {
  setTimeout(() => { // Send response after 10 seconds
    res.writeHead(200, {});
    res.end("RESPONSE");
  }, 1000);
});
apiServer.listen(8888); // Runs on the port 8888

Lua

function Request(Url, Method, Headers)
	local Options = {};
	Options.Url = Url;
	Options.Method = Method;
	Options.Headers = Headers;
	return ({pcall(function() return game.HttpService:RequestAsync(Options); end)})[2]; -- Literally just sends request
end;

for i = 1, 400, 1 do
	spawn(function() print(Request("http://localhost:8888", "GET", {}).Body); end); -- Send much requests in the background
end
spawn(function() while wait(1) do print("1 SECOND"); end; end); -- Print that to separate the "packets"
print("ALL SENT!")

It isn’t hard to notice the behavior.
image
And so what’s on later?
Alright. And now. Run test, don’t wait for the requests to finish, stop test and run again. You won’t get any response for a long time (until these from old test are closed - completed).

image

And so that’s exactly how I wasted 2 days by looking for issue in my scripts. :grimacing: Hard to test polling services later as you don’t get any results later due to the opened connections. :confused:

9 Likes

A post was merged into an existing topic: Off-topic and bump posts

1 Like