#Kicked connectionId # for excessive pings

43 messages · Page 1 of 1 (latest)

final frigate
#

All of my clients are getting kicked from the server very quickly due to this warning. How can I get this to stop happening?

07-23-2023 4-08 PM[WARNING]: Kicked connectionId 3 for excessive pings.
Sentry.Unity.Integrations.UnityLogHandlerIntegration:LogFormat(LogType, Object, String, Object[])
FishNet.Connection.NetworkConnection:CanPingPong()
FishNet.Managing.Server.ServerManager:ParsePingPong(PooledReader, NetworkConnection)
FishNet.Managing.Server.ServerManager:ParseReceived(ServerReceivedDataArgs)
FishNet.Transporting.Tugboat.Server.ServerSocket:<StartConnection>b__22_0()
FishNet.Managing.Transporting.TransportManager:IterateIncoming(Boolean)
FishNet.Managing.Timing.TimeManager:TryIterateData(Boolean)
FishNet.Managing.Timing.TimeManager:IncreaseTick()
FishNet.Managing.Timing.TimeManager:TickUpdate()

#

@royal belfry

#

Is there some option that I can change to get this to stop happening or would I need to comment/remove some code? If so, which code do I need to comment?

#

My Time Manager:
Update Order: Before Tick
Timing Type: Variable
Allow Tick Droping: Enabled
Maximum Frame Ticks : 3
Tick Rate: 30
Ping Interval: 1
Physics: Disabled

royal belfry
#

Using playflow?

final frigate
#

No I'm not sure what playflow is.
@royal belfry

#

See my other post for more info, it was an older post that I forgot I had opened and I just mentined you there.

royal belfry
#

Okay, I've seen this happen but it's always been from playflow running out of RAM.

#

3.7.11 added this ... not sure if it will help - Improved server now resets excessive ping counts on clients when server is running slow.

#

Are you sure there are no other errors?

#

Update to 3.10.3 as well. Shouldn't be a problem but cannot hurt.

final frigate
#

yeah no other errors

#

Its just something to do with sending a receiving a lot of initial data I think.

#

Do you think that'll fix the problem? It takes me 2 hours to be able to test this so I want to be sure, otherwise I'll just comment out the PingPong.cs stuff to keep the connection alive regardless of ping.

royal belfry
#

There's several checks to stop the client from sending pings excessively on client side. Timed checks, tick checks, server response checks etc

#

I may just comment out the kick because I'm not sure what's causing this other than the server maybe having stability/fps issues for a short time(maybe client too)

#

Let me do that and send you the changes. This will require you to be on 3.10.3

final frigate
#

Ok, let me upgrade

royal belfry
#

replace NetworkConnection.PingPong

#
using FishNet.Managing;
using FishNet.Managing.Timing;
using System;
using UnityEngine;

namespace FishNet.Connection
{

    /// <summary>
    /// A container for a connected client used to perform actions on and gather information for the declared client.
    /// </summary>
    public partial class NetworkConnection
    {
#pragma warning disable CS0414
        #region Private.
        /// <summary>
        /// Last tick this connection sent a ping.
        /// </summary>
        private uint _lastPingTick;
        ///// <summary>
        ///// Number of times client has excessively sent a ping.
        ///// </summary>
        //private float _excessivePingCount;
        /// <summary>
        /// Ticks expected between each ping.
        /// </summary>
        private uint _requiredPingTicks;
        #endregion

        #region Const.
        /// <summary>
        /// Number of times a ping may occur excessively before server will punish connection.
        /// </summary>
        private const byte EXCESSIVE_PING_LIMIT = 10;
        #endregion

#pragma warning restore CS0414
        /// <summary>
        /// Initializes for ping.
        /// </summary>
        private void InitializePing()
        {
            //Give the client some room for error.
            float requiredInterval = (NetworkManager.TimeManager.PingInterval * 0.85f);
            //Round down so required ticks is lower.
            _requiredPingTicks = NetworkManager.TimeManager.TimeToTicks(requiredInterval, TickRounding.RoundDown);
        }


        /// <summary>
        /// Resets PingPong values.
        /// </summary>
        private void ResetPingPong()
        {
            //_excessivePingCount = 0;
            _lastPingTick = 0;
        }

        /// <summary>
        /// Called when a ping is received from this connection. Returns if can respond to ping.
        /// </summary>
        /// <returns>True to respond to ping, false to kick connection.</returns>
        internal bool CanPingPong()
        {
            /* Only check ping conditions in build. Editors are prone to pausing which can
             * improperly kick clients. */
#if !UNITY_EDITOR
            return true;
#else
            TimeManager tm = (NetworkManager == null) ? InstanceFinder.TimeManager : NetworkManager.TimeManager;
            /* Server FPS is running low, timing isn't reliable enough to kick clients.
             * Respond with clients ping and remove infractions just in case the
             * client received some from other server instabilities. */
            if (tm.LowFrameRate)
            {
                //_excessivePingCount = 0f;
                return false;
            }

            uint currentTick = tm.Tick;
            uint difference = (currentTick - _lastPingTick);
            _lastPingTick = currentTick;

            //Ping sent too quickly.
            if (difference < _requiredPingTicks)
            {
                //_excessivePingCount += 1f;
                ////Ping limit hit.
                //if (_excessivePingCount >= EXCESSIVE_PING_LIMIT)
                //{
                //    NetworkManager.LogWarning($"Kicked connectionId {ClientId} for excessive pings.");
                //    Disconnect(true);
                //}

                //Return to not send pong back.
                return false;
            }
            //Ping isnt too fast.
            else
            {
                //_excessivePingCount = UnityEngine.Mathf.Max(0f, _excessivePingCount - 0.5f);
                return true;
            }
#endif
        }
    }


}```
#

There's really no reason it should be kicking without an attack attempt by the client

#

I'll probably change it to log something occasionally instead of kick so we can figure out what's going on.

final frigate
#

Ok thanks. I'll get this in the code now. Yeah I know I'm not attacking the server and its still kicking me too.

royal belfry
#

Yeah I figured as much

final frigate
#

On LobbyNetwork.cs after the upgrade I'm getting the following error

#

private void ClientManager_OnClientConnectionState(FishNet.Transporting.ClientConnectionStateArgs obj)
{
if (!ApplicationState.IsQuitting() && obj.ConnectionState != FishNet.Transporting.LocalConnectionState.Started)
ClientReset();
}

#

ApplicationState does not exist in the current context

#

Do you know how I could fix that?

royal belfry
#

add using

#

FN used a lot of utility scripts from my gamekit so I just deleted them and imported the utilities section of gamekit. makes updating a lot easier for me.

final frigate
#

Ok thanks a bunch for the help.
What is gameKit? I hadn't heard of that before.

royal belfry
#

does more but I have to update the read me

#

theres a chat system now and several UI helper things for tooltips, button windows, ect

final frigate
#

Very cool

final frigate
#

@royal belfry
Hey I think GameKit might have made my lists in the inspector look different and no longer show index numbers next to list entries. How can I get numbers back on my list entries in the inspector?

royal belfry
#

@final frigate I filed a bug report with triinspector

final frigate
#

So this will be something that potentially gets pushed into a next release of FishNet, as to where I'll be able to get the fix?

royal belfry
#

Correct.

#

The author is very good and timely with fixes/improvements.

royal belfry
#

@final frigateDo you know of the resolve for the tri-inspector?
I can remove it but its really helpful to have for making public inspectors, since odin decided to never release a license for that =\

final frigate
#

@royal belfry
No I don't know of the resolution.

royal belfry
#

Okay, I'll just pull it out then.