SmartlyDressedGames / Unturned-3.x-Community

Community portion of the Unturned-3.x repo. If you have access to the source code you can find it here:
https://github.com/SmartlyDressedGames/Unturned-3.x/
85 stars 18 forks source link

Stuck at Queue position: #1 #1562

Closed nanashi88 closed 3 years ago

nanashi88 commented 4 years ago

Hello,

starting from last about 7-10 days, I am not able to join a lot of servers, I get stuck at Queue position: #1, sometimes if I press leave then try to join again , I manage to get in , but this doesn't always work, sometimes even if I keep trying, I stay stuck!!

Greetings

joeymisfit commented 4 years ago

Hello @nanashi88,

Try removing all of your Unturned workshops and load back in, see if that works. Make sure you have exited out of Unturned and if you have Unturned installed on your C drive you'll want to go to Program Files (x86) -> Steam -> steamapps -> workshop then delete app_workshop_304930.acf and continue by going to content -> and delete the folder labeled 304930.

Let me know if that works for you!

nanashi88 commented 4 years ago

unfortunately this didn't work :( @joeymisfit thank you for fast reply.

nanashi88 commented 4 years ago

I am admin on servers that I am not able to join, in the logs it show that I connected, but it doesn't show that I disconnected (even after pressing on leave): [3/30/2020 5:24:31 AM] BattlEye Server: Player #1 # (#.#.#.#:#) connected [3/30/2020 5:24:31 AM] BattlEye Server: Player #1 # - BE GUID: # [3/30/2020 5:24:31 AM] Connecting: PlayerID: # Name: # Character: # .... [3/30/2020 5:41:24 AM] BattlEye Server: Player #2 # (#.#.#.#:#) connected [3/30/2020 5:41:24 AM] BattlEye Server: Player #2 # - BE GUID: # [3/30/2020 5:41:24 AM] Connecting: PlayerID: # Name: # Character: #

also I am a module developer, and I see that Player.onPlayerCreated is broadcasted too.

SDGNelson commented 4 years ago

Thanks for the server logs. That gives us an interesting view into how far it is getting on the server-side. Hopefully we can figure out where it is going wrong.

After you get stuck and it has supposedly connected you on the server-side could you attach the client-side Client.log file please? In particular it will be interesting to see if "Accepted by server" is logged.

nanashi88 commented 4 years ago

SDGNelson thanks for response, "Accepted by server" is not logged when it get stuck at queue screen. 2 log files attached.

my friends told me that they see me online in the server for about 1 minute, then auto disconnect (even when I don't press leave) btw, I have 4k+ Unturned hours, and I got this issue only recently.

Greetings log1_(3 times stuck at queue 1).log log2_(first connect got stuck at queue 1, then two successful join).log

SDGNelson commented 4 years ago

Thank you for the detailed logs and descriptions! This is such a bizarre bug. I wish we could find some way to replicate it.

Scratching my head thoroughly examining the relevant code I do not see why it is failing. Especially why it fails to receive a message after they have already exchanged several. The server is definitely sending the accept packet, and there is no reason for the client to discard it. Only thing I can think of at the moment is to add further logging on client and server side to hopefully catch it... 😞

rube200 commented 4 years ago

Could the problem be the "verifyNextPlayerInQueue" method malfunctioning? I already gave you the patch with a plugin and never noticed this problem again.

private static void VerifyNextQueue()
        {
            var accepts = 0;
            foreach (var player in Provider.pending.ToList())
            {
                if (Provider.maxPlayers < Provider.clients.Count + accepts + 1)
                    return;

                if (player?.hasSentVerifyPacket ?? true)
                    continue;

                accepts++;
                player.sendVerifyPacket();
            }
        }
SDGNelson commented 4 years ago

@rube200 It looks like your change is accepting several players in the queue at once depending on the available space. In vanilla the server accepts one player from the front of the queue at a time. This makes me wonder if there is some edge case where verifyNextPlayerInQueue is not called. I will investigate!

rube200 commented 4 years ago
private static void receiveServer(CSteamID steamID, byte[] packet, int offset, int size, int channel)
{
    ...
    if (esteamPacket == ESteamPacket.CONNECT)
    {
        if (Provider.isWhitelisted || !SteamWhitelist.checkWhitelisted(steamID))
        {
            Provider.pending.Add(new SteamPending(...));
            if (Provider.pending.Count == 1)
            {
                Provider.verifyNextPlayerInQueue();
            }
            return;
        }
    }
    ...
}

This forces the server to only accept if the pendant list is 1, in the case of @nanashi88 gets stuck but the server accepts the other players, so I think it was something after that.

nanashi88 commented 4 years ago

just to make the issue a little bit more complicated: some players claimed that the issue is related to ISP, and changing the ISP could solve the problem. so I tried a free VPN, and it worked!! when I am inside the game if I turn on the VPN and join a server I could join normaly, then if I turn off VPN, and try to join I get the issue back and get stuck!! but I don't have issues with other games, and my ISP is considered the best here, so it is not an easy option to change ISP.

nanashi88 commented 4 years ago

more new info: one of the servers I have issue joining , are hosting another game, called Soldat, on same machine that Unturned is hosted on. I am able to join and play Soldat without issues.

SDGNelson commented 4 years ago

@rube200 To clarify about the verifyNextInQueue: I do not think either of those is the problem. verifyNextInQueue is working correctly for nanashi88 because the client is asked for authentication details. Still looking into this. For your reference, here is the source code related to what you posted:

// If server is not whitelist-only then whitelisted players are treated as VIPs.
bool prioritizeInQueue = !isWhitelisted & hasPermit;

if(prioritizeInQueue)
{
    if(pending.Count == 0)
    {
        pending.Add(newPendingPlayer);
        verifyNextPlayerInQueue();
    }
    else
    {
        // Player at front of queue is already in the process of being verified.
        pending.Insert(1, newPendingPlayer);
    }
}
else
{
    pending.Add(newPendingPlayer);

    // If there are other players in the queue then they are already being verified.
    bool nobodyElseInQueue = pending.Count == 1;
    if(nobodyElseInQueue)
    {
        verifyNextPlayerInQueue();
    }
}
SDGNelson commented 4 years ago

For the next update I have introduced significantly more logging to both the client and server sides related to joining and leaving. Hopefully it will give us an idea of what is actually received by the client. One change that may be particularly useful server-side is logging why the front of queue player timed out (vac, economy, group) - though I do not think that is the case here.

Will remove the next update label for to-do list tracking purposes, but feel free to comment and I will follow up after the update. Fingers crossed.

nanashi88 commented 4 years ago

thank you for adding more logs. in the following file , first it shows a failed try to join server(get stuck at queue), then it show a successful join for another server: https://cdn.discordapp.com/attachments/645970747344420865/711360536759107694/message.txt hope this gonna help

SDGNelson commented 4 years ago

Thank you for sharing the log file!

Is the failed to join server one you have control over? The server-side logs may have further details, in particular if the -ConstNetEvents command-line option is enabled.

On another note, it is odd that the successful connection does not log "Connection pending verification" whereas the unsuccessful one does. This is not a big deal but odd...

nanashi88 commented 4 years ago

I don't have control, I am admin and developer on those servers, I will ask the owner to open test server with -ConstNetEvents thank you for fast response

SDGNelson commented 4 years ago

Thank you for trying with that option. Fingers crossed that the server log helps us finally track this down!

nanashi88 commented 4 years ago

I have tried to join a server with -ConstNetEvents command-line option is enabled. here is logs: UT_logs.txt

SDGNelson commented 4 years ago

Thanks for sharing that log. Is that sever running the latest version? The server log is missing several entries, for example it should say "Added player 77561198028565546".

It looks like the connection got further that time, as your client actually logged in and spawned the player character, but the server was ignoring the inputs. The missing server-side logs are a mystery however... will investigate.

nanashi88 commented 4 years ago

"Added player 77561198028565546" was printed at client side only. also I tried a local server, and it didn't print "Added player 77561198028565546" on server side! (btw, I don't have issues joining local server) here is new logs after updating the test server: first I try to join 3 times, but it all fail, then another players success to join after me UT_logs2.txt

SDGNelson commented 4 years ago

Which server log file is it? I just double-checked and my local server does log "added player". The server log file should be at: U3DS/Logs/Server_(server name).log

What we do know is that locally it is creating the player for yourself, but not creating any of the other players on the server. It will be interesting to see in the full log whether it is running into an exception when sending that information or what.

nanashi88 commented 4 years ago

ops, what have I posted is copy -paste of server console messages I will try get that log file as soon as possible

SDGNelson commented 4 years ago

Ah, thanks! Since it may be a big or private file feel free to email instead: nelson@smartlydressedgames.com

nanashi88 commented 4 years ago

Server_test.log I just finished faking ips and ids. next time I will mail it, mailing it is better and easier option ^^

SDGNelson commented 4 years ago

Thanks for the server log file! Okay what we can see here is:

Do you know what the MMod_plyrCreated_PIN1010 is? It is probably unrelated, but is a potential lead.

On the client side we know that the only player you were told about is yourself, so only the first connected message went through. Thinking about what this means now. 🤔

nanashi88 commented 4 years ago

after I submited these logs, I will try summary my issue:

First attempt was kicked because BattlEye could not establish a connection. Did you get any BattlEye message on the client side for this one?

I don't remember if I got message or not. but in general, I don't get any message.

The second and third attempts closed because the Steam session was ended ~30 seconds afterwards. My guess is that this was when you clicked the Cancel button on the queue screen.

true, but in general, when this amount of time already passed, I know that I am stuck, because noramlly it takes much less than that to join server after seeing queue #1 screen.

Do you know what the MMod_plyrCreated_PIN1010 is? It is probably unrelated, but is a potential lead.

it is from our module, binded to Player.onPlayerCreated, but I still having the issue even when server running without modules. also our servers so busy, so I think no issues from our module.

On the client side we know that the only player you were told about is yourself, so only the first connected message went through. Thinking about what this means now.

sorry, forgot to say there was no players in the test server when I tried to join, other players joined later.

SDGNelson commented 4 years ago

This is just so bizarre. I've re-read this and the code several times, but there seem to be no leads to go off of. No errors in the logs, working with VPN, working for other players... Bah.

You mention that you still have this issue when the server is running without modules. To double-check for my sanity, can you give that another try? i.e. temporarily running a test instance on that server without RocketMod and without your custom module and trying to connect.

ghost commented 4 years ago

This might not help, but I figure it would be worth mentioning. Back in ~2017-2019? there used to be an issue just like this where you would get stuck on Queue Position 1 however be loaded into other players. You could even hear the game audio, punch, and hear yourself punching. This used to just be able to be fixed by verifying files via Steam.

Back then in the top left when that happened you would get stuck on loading "Lighting" if I remember correctly.

SDGNelson commented 4 years ago

Unfortunately @PandahutMiku in this case it is stuck earlier in the loading process. (Lighting and other requests are handled later after being fully accepted into the server.)

nanashi88 commented 4 years ago

sorry for late response, previous days were busy days. disabling all modules haven't solved the issue. also tried to disable VAC and Battleye, but didn't help I did 4 tests on this, I will send all logs (my logs , friend logs, servers logs) to nelson@smartlydressedgames.com it include 10 log files, 1 readme file describing the tests

SDGNelson commented 4 years ago

(following up through email)

nanashi88 commented 3 years ago

apparently the recent game update (rewrite of NetTransport) has solved the issue. I am so happy, finally I don't need to pay for 2 ISPs :) @SDGNelson thank you 👍

SDGNelson commented 3 years ago

Phew! Glad to hear that the new Steam Networking has resolved the issue.