HTTPRequest is taking upwards of 30 seconds to initiate a request. I can monitor the http access log and see that the request doesn’t even reach the server until 30 seconds after initiating the request in Godot.
Anybody have an idea on what is causing this latency? I’m not sure how to debug and see what HTTPRequest is doing, but Godot seems to be stalling on something before sending the request.
Is the version_check method running at the time you’re expecting it to run? Just to make sure that it’s the HTTP request itself that takes long to start and not some other part that runs before the request.
Aside from that, two things come to mind but neither is comfy to do. One is to install Wireshark and examine the outgoing traffic and hope it reveals something. The other is to check Godot source code if there’s something going on that might cause this.
Most of the possible network-level issues ( like DNS resolution ) are eliminated by curl running in a reasonable timeframe imo.
Thanks for the suggestions. Yes, I also should have confirmed that version_check is called when expected, the delay isn’t introduced somewhere else in the surrounding logic.
I think I have narrowed down the issue to an IPv6 misconfiguration on the server.
curl --ipv6 "https://example.com/version_check.json"
> curl: (28) Failed to connect to example.com port 443 after 75008 ms: Couldn't connect to server
I suspect that Godot is attempting an IPv6 connection by default, then times out after 30 seconds, then makes a second attempt with IPv4, which then succeeds.
I’m not sure if I could force Godot to prioritize IPv4 over IPv6. But I’m going to shift focus on fixing IPv6 on the server, since that needs to be fixed anyway. That should resolve this issue.
You might be able to do it by resolving the IP address of the domain with IP.resolve_hostname forcing IPv4, and then pass that to the request. To be sure, override the Host header to the original domain, so the server knows which host you’re accessing behind that IP address.