Crash on http.request on Windows when offline

Recently I tried testing how our project handles the user being offline during startup.

However for me, it just crashes on startup with the following error:
Assertion failed: address.m_family == DOMAIN_IPV4, file …\src\dlib\socket.cpp, line 387

I’ve tracked this down to our http.request calls. There’s a few, and any of them will trigger this error. Some of them are GET, some are POST. The simplest doesn’t have any headers and looks like this:
http.request(self.ping_server, “GET”, http_result)

I am using Windows and Defold 1.2.164. My colleague who has a Mac does not get these errors on the same project and same Defold version. Neither do the problems appear on an Android build.

2 Likes

Hi Noora! That’s a bit weird. The crash happens in the socket connect code and it looks like this:

Result Connect(Socket socket, Address address, int port)
{
    int result = 0;
    if (IsSocketIPv4(socket))
    {
        assert(address.m_family == DOMAIN_IPV4);

So, for some reason, the socket is identified as an IPv4 socket but the Address isn’t?!

And this happens on Windows when you are offline (when the application starts?) and try to make any HTTP request? Or is there more steps needed to trigger the crash?

1 Like

Hmm could it have something to do with how I go offline? I’ve simply disabled Ethernet in the Control Panel.

This happens on Windows after I’ve disabled internet as soon as I try to make a http request. (That just happens to be during application startup for my project.) I haven’t tested on a bare-bones project yet but I doubt there’s any more steps to it than calling http.request.

Ok, thanks. This is definitely something we’d like to look into. Created ticket: 4585

2 Likes

Mathias just merged a fix for this issue. It will be released in 1.2.165.

2 Likes

It happens also to me, so I’d like to check the solution, is it in any channel already?

I believe it’s fixed in the alpha channel

2 Likes