HTTP request fails with (http result: -1 socket result: -100)

Hello! I am getting this message in the logs:

ERROR:SCRIPT: HTTP request to ‘http://bla-bla-bla/0.093211’ failed (http result: -1 socket result: -100)

The game is polling to a server regularly to exchange some data. It works perfectly 99% of time, but from time to time, the http.request is done, the response callback is called after around 30 seconds, the request status is 0 and there is no request response.

Any idea about what this (http result: -1 socket result: -100) means?

I am using the last version of Defold 1.2.159

I have never seen this behaviour on the editor, but it happens on iOS and Android on different devices.

Thanks!

1 Like

Hm, if the callback is called after 30s it might be a DNS issue. Is the issue easily to reproduce? If so, could you try an older version of Defold (1.2.154 or lower) and see if the issue is still there? We recently changed our DNS resolver and we might have missed edge cases. Ping @sven: could you find a version of the editor without c-ares and paste it here?

Oooops, sorry, the callback was called after about 3 seconds (I was playing with the http timeout value in game.project).

DNS could make sense, as the request is not received in the server.

I also have this message in the logs (that confused me about the 30 seconds…) just after the HTTP failed message:
WARNING:DLIB: Profiler Physics.UpdateKinematic took 30.022 seconds

In other cases, I see this message:
WARNING:DLIB: Profiler Physics.TriggerCallbacks took 30.047 seconds

I will try 1.2.154 in the meantime.

Does this socket_result: -100 helps to diagnose the issue?

Thanks!

Having problems trying to download an older editor… Should it be this link?

https://d.defold.com/editor2/1a8f9e14786e6779405aedf490ebb82da01d7198/editor2/Defold-x86_64-darwin.dmg

More info… :slight_smile:

Changed the DNS of the server to its IP in the request, and it still fails.

It took 6 seconds to fail now. And I got this message just after the http request failed:
WARNING:DLIB: Profiler Render.DrawRenderList_SORT took 30.053 seconds

I don’t have the code in front of me as i am on vacation right now so I don’t know exactly what those Numbers mean. Maybe we should change them to the actual enum string name… but what sparked my thought about DNS is the 30 seconds as it is the usual timeout value for a DNS request that doesnt finish. Have you tried it under other circumstances such as different networks and/or servers?

Yes, it failed the same way on different networks… I can move the backend to a different server and see if it makes a difference.

Thanks!

1 Like

Tried with a different server, still the same problem…

Is there an easy way to download an old version of the editor?

Thanks in advance!

Sure, read here: https://www.defold.com/manuals/install/#_install_an_old_version

Hey!

Thanks, downloaded an old version but the problem is still there. I get these “http result: -1 socket result: -100” errors frequently. Looking at the logs of the application, when the error happens, I usually get these kind of messages in the logs also:

WARNING:DLIB: Profiler Render.DrawRenderList_SORT took 30.053 seconds
WARNING:DLIB: Profiler Physics.TriggerCallbacks took 30.047 seconds
WARNING:DLIB: Profiler Physics.UpdateKinematic took 30.022 seconds

Everything looks fine on my server. Any hint what this warnings mean, so that I can try to debug my application?

Thanks!

These errors indicate that something takes a very long time to complete. In this case physics and rendering. What kind of game are you working on?

What kind of server are you trying to connect to? Does this error ever happen when connecting to anything else? Does it happen all the time when connecting to your server or only sometimes?

-100 indicates RESULT_HOST_NOT_FOUND when doing gethostbyname. And it seems like this error code can happen when a timeout occurrs. We changed to c-ares in Defold 1.2.153 to be able to do asynchronous DNS lookup (old engine versions would block while doing DNS lookups). Which old version did you try?

I find it suspicious that you’re seeing just above 30 second log warnings. 30 seconds matches a timeout in the DNS lookup. I wonder which is cause and which is effect. Is it the DNS lookup (which should be async) that causes the engine to lock up (the physics and render warnings you got) or is it the other way around?

On which platform(s) have you tested?

Hi @britzl, thanks a lot for the answer!

The game is a very simple 2D casual game, PVP. No physics, no 3D, performs at 60fps on mostly all devices.

The server is also a very simple node.js server. I tried with a dockerized version of the server on ECS and also running directly (not into a container) on an EC2 instance, with the same result.

The -100 error happens sometimes. Let’s, say, a round of the game is typically 3 minutes, it happens 1 out of 3 games.

I tried Defold 1.2.154! Bad choice it seems. I am checking now with a version older than 1.2.153.

I only see the “took 30.053 seconds” messages when the socket -100 error happens. So my educated guess is that -100 is the cause and “took 30.053 seconds” the consequence, just intuition.

The error never happened to me on the editor version running on a Mac. It happens on iOS and Android, on different devices.

I tried to use directly the IP of the server instead of the DNS, but it failed the same way. Makes sense?

Hello!

I confirm that Defold 1.2.152 works well, I do not see these -100 errors anymore, and my game works as expected.

Is there a way I can help to debug this issue on Defold > 1.2.152?

Thanks!

Is it possible to get the URL to your server plus instructions to access it to reproduce the problem? You can PM details if you want to.