Facepunch / Facepunch.Steamworks

Another fucking c# Steamworks implementation
MIT License
2.93k stars 350 forks source link

Randomly getting NetConnectionEnd.Misg_Generic (5001) when connecting #761

Open kingstone426 opened 7 months ago

kingstone426 commented 7 months ago

Describe the bug

I am having trouble with Facepunch networking where some clients randomly experience Misc_Generic error during playtests. Unfortunately, I haven't been able to reproduce it on my dev environment (2 computers on 2 accounts, one connecting over vpn). It only happens during our playtests, with external testers. The error occurs when a client tries to connect to a server, never after a connection has been established. The same player can usually connect to a server after restarting the client.

I looked up the Steamworks code comments on Misc_Generic but it is not very enlightening:

// A failure that isn't necessarily the result of a software bug,
// but that should happen rarely enough that it isn't worth specifically
// writing UI or making a localized message for.
// The debug string should contain further details.
k_ESteamNetConnectionEnd_Misc_Generic = 5001,

To Reproduce

This is not a 100% repro, but generally:

  1. Start a server
  2. Connect 1-4 clients
  3. At least one of the clients may fail to connect with a 5001 error

Calling Code Server:

var serverInit = new SteamServerInit(Application.productName, Application.productName);

if (!SteamServer.IsValid)
{
    SteamServer.Init(SteamClient.AppId, serverInit, false);
    Logger.Info("SteamServer Initialized");
}

steamSocketManager = SteamNetworkingSockets.CreateRelaySocket(0, this);

Client:

steamRelayConnection = SteamNetworkingSockets.ConnectRelay(HostSteamId, 0, this);

Expected behavior 100% of attempted connections should succeed.

Desktop: