New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP requests are causing the server to freeze #5515
Comments
This issue can be reproduced inconsistently in singleplayer or in P2P servers on Windows ( |
The issue can be reproduced constistantly on any machine that I have tried, as long as its using Pterodactyl as its panel, Using CHTTP or Reqwest doesn't work around the issue at all. This is issue has only appeared since the latest gmod update where DNS resolving was changed. It appears that its being done on the main thread and causing the CPU to spike in use. |
I can confirm that there is a problem with the freeze due to DNS resolve (maybe) in main branch
|
I haven't found a workaround yet. This makes my servers difficult to play. If anyone has found a solution, please share it! |
Same thing for my server. We try CHTTP but it doesn't work properly. |
I have updated the implementation on |
Indeed yes, I mean a server freeze for about 5 seconds, after which it unfreezes. I'll test the modification on my side, thanks. |
@robotboy655 I was not able to reproduce the bug with the dev branch. It seems like it's fixed! |
Looks good for me too @robotboy655 |
As far as I can see it's still reproducible on the dev branch. The problem is if the url is invalid something is blocking. If the servers got any addons that allow users to provide a URL that does a http.Fetch and they provide an invalid URL or ip... Lag spikes for days. For instance, A fine none blocking 3 gets. A fully blocking 3 gets. (img URL from a post above.) For now I personally have a cheap vps just verifying urls by running a get request from the vps before running any direct gets. Keep in mind this does mean all http.Fetchs that run have an extra delay but you'll never get the freezing that is happening at the moment. This is using my cheapo vps. Leaving the IP in so you can use it too if you don't want to also set up a Flask app or whatever other API stuff. local api_url = "http://72.14.182.169/check_url?url="
http.Fetch(api_url .. "https://google.com",
function()
globalOldFetch = http.Fetch -- Made global so we can undo this live if needed.
http.Fetch = function(...)
print("Fetch: Checking")
local args = {...}
globalOldFetch(api_url..args[1],
function(body, len, headers, code)
if code == 200 then
print("Fetch: Valid")
globalOldFetch(unpack(args))
else
print("Fetch: Invalid")
args[3]("invalid url")
end
end,
args[3]
)
end
end,
function()
print("http.Fetch temp fix url check api is down")
end
) |
I have updated |
Hey, Edit: Just for information, when I do a loop for 500 requests with invalid domains, I have a CPU spike to 0% for 2 seconds. |
To clarify for anyone that sees this at the moment. The issue I was finding of any URL that wouldn't resolve to a valid IP causing a freeze seems to require you to have a VPN on. Or at least it does for me... I have nord VPN on 24/7 and didn't realize it was related. So it might only affect VPN users. |
It seems to be fixed. But at some point I had an weird bug. I am sending 243 http.Fetch and 38 of them are dead site. At some point my internet dies (the internet provider sneezed and changed my dynamic ip address), and all 243 requests "failed to resolve domain". And I got 4 freezes of 11 seconds each, the first three prints 3 domains, the fourth prints the remaining 234 domains. This is probably because there are too many threads, because in my test I create them in single tick (so don't do that). upd: edited info that internet has died |
I am rolling back the changes as it just refuses to work correctly even in a thread. Might try again later. |
Details
I'm opening this GitHub issue after all the servers on my machine started experiencing irregular server freezes for a few seconds, since the last update.
After several tests and attempts to understand the problem with some members on the Garry's Mod Discord, we concluded that this wasn't due to some code, but rather the HTTP function. This doesn't seem unreasonable considering there was an update related to DNS lookup recently.
My machine is hosted at OVHCloud. The firewall restricts TCP traffic to a bare minimum (we do not use TCP port 27015), and UDP is completely open but goes through OVHCloud mitigation, only on the ports of the Garry's Mod servers. We are using pterodactyl (so Docker).
I'm not the only one who has had this problem, I've had several colleagues who had the same issue, all were at OVHCloud but that doesn't necessarily make it the cause.
UPDATE: I've had people who weren't with OVHCloud have the same problem. However, they were all using pterodactyl.
Steps to reproduce
lua_run for i = 1, 20 do http.Fetch("https://google.com", function() end, function() end) end
(you can try with any URL)You should see that your server traffic will be cut off for a few seconds, as it simply stops responding. Some servers do, some don't.
However, I don't think it's specifically related to the number of requests made at the same time, as the crashes happened even when only a single request was made on my server. I haven't been able to identify the exact source of the problem, but reproducing it is probably a good start to understanding the issue!
The text was updated successfully, but these errors were encountered: