Network error messages are too vague to be useful.

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
Moosfet
Long Handed Inserter
Long Handed Inserter
Posts: 64
Joined: Fri Jun 10, 2016 1:50 pm
Contact:

Network error messages are too vague to be useful.

Post by Moosfet »

When trying to connect to a friend's server, I got this error: "couldn't establish network communication with server"

That is far too vague to be helpful. What exactly does it mean? I can think of many things it might mean:

1. DNS look-up failure: Maybe I typed the domain name wrong. Maybe I should just try an IP address instead.
2. ENETUNREACH - Probably my ethernet cable came unplugged or my WIFI connection died.
3. EHOSTUNREACH - Maybe I typo'd the IP address.
4. ETIMEDOUT - The computer the server runs on is probably turned off.
5. ECONNREFUSED - Either the server software isn't running, or my friend didn't forward the port properly, or Windows firewall is blocking the connection.
6. Factorio protocol negotiation failures -- Maybe we're running different version of Factorio. Maybe this version of Factorio is just broken.

I never figured out the cause. My friend checked his port forwarding and it seemed to be correct. We tried connecting the other way (him connecting to my computer) to verify that the game wasn't just broken, and that worked fine. So then I had a look at the console hoping to find a more specific error message, but all I found was this:

181.743 Info ClientMultiplayerManager.cpp:573: MapTick(4294967295) changing state from(Ready) to(Connecting)
183.574 Warning TransmissionControlHelper.cpp:176: Fragment 0000 failed too many times
184.424 Error ClientMultiplayerManager.cpp:95: MultiplayerManager failed: multiplayer.not-received-connection-accept-reply

However, "not-received-connection-accept-reply" is also an error message that could mean many things, e.g. it could mean ECONNREFUSED, or it could mean the connection was accepted, but then in the Factorio protocol, the server failed to respond to some request to connect to the game. In particular "Fragment 0000 failed too many times" sounds like maybe it was connected and trying to transfer game data? I don't know, as a "fragment" could be almost anything too.

All I knew was that it didn't seem to be ECONNREFUSED as my friend said that he could see activity on his end when I tried to connect, even though my own game was giving no indication that it had made any contact with the server at all. So I thought maybe the game uses both TCP and UDP and he only forwarded one, but he checked that and said both were forwarded.

So I began to use Linux's "strace" program (which displays what system calls a program makes, and what the results are and what data is transferred) to determine what the actual problem was since Factorio clearly wasn't going to tell me, but then the problem spontaneously went away, so I never was able to figure out what the problem was.

Anyway, regardless of what the actual problem was, users shouldn't have to resort to using strace to figure out what part of connecting to a multiplayer game has failed. Factorio knows exactly what went wrong when it was trying to establish network communication with the server. If it would just say what that was, then users could use that information to narrow down the list of possible resolutions to the problem. A specific error message is an error message that users can Google and find specific steps that might actually resolve their problem. Vague error messages just lead to long lists of completely random suggestions, most of which have nothing to do with the actual problem that is occurring.

Moosfet
Long Handed Inserter
Long Handed Inserter
Posts: 64
Joined: Fri Jun 10, 2016 1:50 pm
Contact:

Re: Network error messages are too vague to be useful.

Post by Moosfet »

I thought this made much more sense under "bug reports" where I originally put it. It's not like I'm proposing that Factorio do something new here. Factorio already displays error messages.

Someone just needs to look at the error messages and ask themselves "what other situations could this error message refer to" and if they come up with any ideas, rewrite the error message until they can't. It's just a matter of thinking about potential ambiguities while writing the error messages so that they can be avoided. It should take all of 15 minutes and afterwards everyone will have an easier time figuring out what Factorio needs us to do when it isn't able to connect to multiplayer servers.

No doubt this is a low-priority bug, but I'm not asking that it be fixed before game crashes. I'm just saying it should be fixed before the game developers start looking for new features to implement.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Network error messages are too vague to be useful.

Post by Rseding91 »

If DNS failed you would get an error stating that:

Image

If the game versions weren't correct you would get an error stating that:

Image

Other reasons why communication would fail all fall down to "the internet isn't reliable". The game will try to re-send packets a few times and eventually if they don't make it through it says "I tried, they could have failed for any number of reasons" and you get the generic "couldn't establish network communication with server".
If you want to get ahold of me I'm almost always on Discord.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Network error messages are too vague to be useful.

Post by Rseding91 »

Additionally if sending a packet fails the game does log it - which you would see in the log file:

Code: Select all

  if (sent == SOCKET_ERROR)
  {
    int error = lastSocketError();
    switch (error)
    {
      case SocketErrorCode::eintr:
      case SocketErrorCode::enetdown:
      case SocketErrorCode::enetunreach:
      case SocketErrorCode::ehostunreach:
      case SocketErrorCode::ehostdown:
      case SocketErrorCode::econnrefused:
        LOG_INFO("Sendto failed (but can be probably ignored): " + lastSocketErrorString(error));
        break;
      case SocketErrorCode::ewouldblock:
      // Send buffers are full.
      // Since the only time when this can happen is when using file transfer source
      // and we cannot simply delay the response, we ignore this error.
      // It will be solved using the regular packet loss mechanism.
      case SocketErrorCode::eperm:
      case SocketErrorCode::enobufs:
      case SocketErrorCode::einval:
        LOG_WARNING("Sendto failed: %s; data length = %u, address = %s",
                    lastSocketErrorString(error).c_str(), uint32_t(data.size()), address.logFileRemovableIpStr().c_str());
        break;
      case SocketErrorCode::emsgsize:
        LOG_WARNING("Sendto failed: %s, Message size: %d", lastSocketErrorString(error).c_str(), int32_t(data.size()));
        LOG_INFO("Data: %s", StringUtil::hexDump(data.data(), Math::min(data.size(), size_t(10000))).c_str());
        throw SendtoFailedError("Sendto failed: " + lastSocketErrorString(error));
      default:
        throw SendtoFailedError(ssprintf("Sendto (%s) failed (%d: %s)", address.logFileRemovableIpStr().c_str(), error, lastSocketErrorString(error).c_str()));
    }
  }
  else if (sent != int(data.size()))
    throw SendtoFailedError("Sendto didn't send all data.");
Which means in your case everything you sent was being sent successfully and no errors where generated simply the packets either didn't reach the destination or you didn't get any response back from the server.
If you want to get ahold of me I'm almost always on Discord.

Moosfet
Long Handed Inserter
Long Handed Inserter
Posts: 64
Joined: Fri Jun 10, 2016 1:50 pm
Contact:

Re: Network error messages are too vague to be useful.

Post by Moosfet »

Well, we know what happened then.

As for the bug report side of this, look at it from the perspective of someone who hasn't seen all of the other error messages, and thus doesn't know that "couldn't establish network communication with server" doesn't cover all of the other error messages you showed me. From that perspective, it might as well just say "something went wrong." I realize that in this case there's no way for Factorio to know exactly what went wrong, but it can at least communicate what little it knows about the situation by saying something like "I sent UDP packets to the server, but I never received a response."

Post Reply

Return to “Ideas and Suggestions”