GameLift Server kicks player because of no response to ping

0

Hello, I followed the MegaFrogRace in the aws-tutorial repo, but I have ran into an issure. For some reason, the Server kicks the player I have connected with. Here are the logs, the message I found to be odd are fat:

06 Sep 2020 16:41:37,960 [INFO] (MultiChessServer.js) 218: Starting process... 06 Sep 2020 16:41:37,960 [INFO] (MultiChessServer.js) 219: Ready to host games... 06 Sep 2020 16:41:37,960 [INFO] (metric-publisher.js) 28: Publishing metrics: {"metrics":[{"name":"RTSProcessStartedTime","unit":"Milliseconds","value":0,"timestamp":"2020-09-06T16:41:37.960Z","dimensions":[]}]} 06 Sep 2020 16:41:37,963 [INFO] (metric-publisher.js) 28: Publishing metrics: {"metrics":[{"name":"RTSProcessStarted","unit":"Count","value":1,"timestamp":"2020-09-06T16:41:37.963Z","dimensions":[]}]} 06 Sep 2020 16:41:37,963 [INFO] (index.js) 241: onProcessStarted success. Process ready for games. 06 Sep 2020 16:41:37,963 [INFO] (index.js) 261: Game session initialized with port: 1900 06 Sep 2020 16:41:37,964 [INFO] (gamelift.js) 223: Realtime server started! Calling GameLiftServerAPI.ProcessReady with processParameters: {"Port":1900,"LogParameters":{"LogPaths":["/local/game/logs/5169"]}} 06 Sep 2020 16:41:37,998 [INFO] (gamelift.js) 71: (Heartbeat) GameLiftServerAPI initiating OnHealthCheck 06 Sep 2020 16:41:37,998 [INFO] (gamelift.js) 229: Process advertised to AuxProxy! GameLiftServerAPI.ProcessReady succeeded 06 Sep 2020 16:41:37,998 [INFO] (gamelift.js) 231: GameLift Realtime server process started successfully. 06 Sep 2020 16:42:38,1 [INFO] (gamelift.js) 71: (Heartbeat) GameLiftServerAPI initiating OnHealthCheck 06 Sep 2020 16:42:40,32 [INFO] (gamelift.js) 36: GameLiftServerAPI initiating StartGameSession: {"Port":1900,"GameProperties":[],"MaximumPlayerSessionCount":2,"******** 06 Sep 2020 16:42:40,33 [INFO] (MultiChessServer.js) 226: [app] onStartGameSession 06 Sep 2020 16:42:40,34 [INFO] (gamelift.js) 39: GameLiftServerAPI completed StartGameSession 06 Sep 2020 16:42:40,553 [INFO] (index.js) 469: Player 1 connected from ******* 06 Sep 2020 16:42:40,553 [INFO] (ws.js) 139: Player 1 connecting from ********* 06 Sep 2020 16:42:40,695 [INFO] (index.js) 202: Message received from player 1 06 Sep 2020 16:42:40,697 [INFO] (index.js) 210: Packet (including both internal messages and custom game messages) received from player: 1 06 Sep 2020 16:42:40,697 [INFO] (index.js) 378: Handling login request from player: 1 06 Sep 2020 16:42:40,697 [INFO] (index.js) 381: Player 1 logging in 06 Sep 2020 16:42:40,698 [INFO] (index.js) 388: Player: 1 is connecting to player session: psess-fac6f9ec-8e6f-4b3c-81a0-f599bc997649 06 Sep 2020 16:42:40,698 [INFO] (gamelift.js) 83: Calling GameLiftServerAPI.AcceptPlayerSession with player session id: psess-fac6f9ec-8e6f-4b3c-81a0-f599bc997649 06 Sep 2020 16:42:40,716 [INFO] (gamelift.js) 88: GameLiftServerAPI.AcceptPlayerSession succeeded with player session id: psess-fac6f9ec-8e6f-4b3c-81a0-f599bc997649 06 Sep 2020 16:42:40,716 [INFO] (index.js) 395: Successfully connected player: 1 to player session: psess-fac6f9ec-8e6f-4b3c-81a0-f599bc997649 06 Sep 2020 16:42:40,716 [INFO] (MultiChessServer.js) 178: [app] onPlayerConnect: undefined 06 Sep 2020 16:42:40,716 [INFO] (MultiChessServer.js) 195: [app] onPlayerAccepted: player.peerId = 1 06 Sep 2020 16:42:40,717 [INFO] (MultiChessServer.js) 201: [app] onPlayerAccepted: new contents of players array = [object Object] 06 Sep 2020 16:42:40,717 [INFO] (MultiChessServer.js) 55: [app] SendStringToClient: peerIds = 1 opCode = 100 stringToSend = 1 06 Sep 2020 16:42:40,717 [INFO] (MultiChessServer.js) 58: [app] SendStringToClient: sendMessageT [object Object] undefined 06 Sep 2020 16:42:40,717 [INFO] (index.js) 346: Received custom game message from sender: -1 with opCode: 100, targetPeerId: 0, targetGroupId: 0 06 Sep 2020 16:42:40,717 [ERROR] (index.js) 371: Message was missing a target player and target group. Message: {"opCode":100,"sender":-1,"payload":{"type":"Buffer","data":[49]},"reliable":false} 06 Sep 2020 16:42:40,718 [INFO] (index.js) 430: Sending login result to player: 1 06 Sep 2020 16:42:43,755 [INFO] (index.js) 202: Message received from player 1 06 Sep 2020 16:42:43,755 [INFO] (index.js) 210: Packet (including both internal messages and custom game messages) received from player: 1 06 Sep 2020 16:42:43,755 [INFO] (index.js) 346: Received custom game message from sender: 1 with opCode: 200, targetPeerId: -1, targetGroupId: 0 06 Sep 2020 16:42:43,756 [INFO] (MultiChessServer.js) 153: [app] onMessage(gameMessage): 06 Sep 2020 16:42:43,756 [INFO] (MultiChessServer.js) 154: { opCode: 200, sender: 1, payload: Uint8Array [], reliable: true } 06 Sep 2020 16:42:44,11 [WARN] (index.js) 144: Player 1 did not respond to the last ping. Terminating the player client. 06 Sep 2020 16:42:44,11 [INFO] (ws.js) 195: TCP client connection for player: 1 is terminated by the server 06 Sep 2020 16:42:44,12 [INFO] (index.js) 474: Player 1 disconnected from ********** 06 Sep 2020 16:42:44,12 [INFO] (gamelift.js) 93: Calling GameLiftServerAPI.RemovePlayerSession with player session id: psess-fac6f9ec-8e6f-4b3c-81a0-f599bc997649 06 Sep 2020 16:42:44,34 [INFO] (gamelift.js) 98: GameLiftServerAPI.RemovePlayerSession succeeded with player session id: psess-fac6f9ec-8e6f-4b3c-81a0-f599bc997649 06 Sep 2020 16:42:44,34 [INFO] (MultiChessServer.js) 209: [app] onPlayerDisconnect: 1 06 Sep 2020 16:42:44,34 [INFO] (MultiChessServer.js) 103: [app] StopGame - killing game session 06 Sep 2020 16:42:44,34 [INFO] (gamelift.js) 103: Calling GameLiftServerAPI.ProcessEnding

Is the answer to a ping something I have to implement on the client side?

已提問 4 年前檢視次數 260 次
5 個答案
0
已接受的答案

8921 works on PC and Mac if you want to just hardcode it. Only problem you'll have with using just that port is you won't be able to have multiple instances open on one Mac.

UPDATE:

Actually, here you go this code will work for both Mac and Windows.

using System.Net;
using System.Net.Sockets;

private static readonly IPEndPoint DefaultLoopbackEndpoint = new IPEndPoint(IPAddress.Loopback, port: 0);
    public static int GetAvailablePort()
    {
        using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))
        {
            socket.Bind(DefaultLoopbackEndpoint);
            return ((IPEndPoint)socket.LocalEndPoint).Port;
        }
    }

I've also added a Pull Request to fix this in the demo scene, if you could inform whoever is in charge of that repo @REDACTEDUSER

已回答 4 年前
0

We have also ran into this issue and have mostly resolved it by building adding the DTLS libraries for the Unity SDK. One of our developers is still experiencing this when using his home WiFi, and in some cases it can still intermittently happen while playing our game. Is there a way to prevent the Real-time client/server to even create a UDP connection at all? We plan on using Reliable messages exclusively anyway, but if I understand correctly it seems like a failure in creating a DTLS connection is causing the client connection to be terminated by the server.

已回答 2 年前
  • Hey, have you found a more concrete solution for this? Thank you, I am having similar issues and another post suggest it has to do with the cert

0

Hmm that seems odd.

Can you confirm where you got the megafrog race sample code from? From https://github.com/aws-samples/megafrograce-gamelift-realtime-servers-sample ?

Ping/Pong response code should happen automatically in the websockets layer. Theres nothing you need to do here its something the server/receiver handle automatically.

I would confirm that the player didn't drop their connection or get somehow cpu/thread bound preventing a response to the ping.

The current server code is very strict so a single failure here results in player disconnection; you could obviously make this more robust by adding a count of ping failures prior to termination.

In script you can change the pingIntervalTime configuration which may help.

已回答 4 年前
0

Thanks for the reply, but I think I found my issue. I am working on a Mac, which doesn't support the GetActiveUdpListner function. I had read about it here: https://forums.awsgametech.com/t/going-through-tutorial-and-getting-notimplementedexception-the-method-or-operation-is-not-implemented-on-getactiveudplisteners/6561

I implemented my own version to find a free UDP Port, but it seems that did't work as I had hoped. Since I got an initial connection to the server, I thought the problem were somewhere else, but when testing it on a windows computer with the original code to find a UDP port, I had no issues and everything worked.

已回答 4 年前
0

Thanks ever so much for the fix. I'll forward it on to the GameLift team.

已回答 4 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南