EscalateTimeQuotaMSPerPeriod

EscalateTimeQuotaMSPerPeriod

#Overview

name: EscalateTimeQuotaMSPerPeriod

The value of this variable can be defined or overridden in .ini config files. 5 .ini config files referencing this setting variable.

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of EscalateTimeQuotaMSPerPeriod is to set a time-based threshold for RPC (Remote Procedure Call) execution within the Unreal Engine’s network subsystem, specifically for DoS (Denial of Service) detection and prevention.

This setting variable is primarily used by the networking subsystem of Unreal Engine, particularly in the RPC DoS detection module. It’s part of the engine’s built-in protection against potential DoS attacks or unintentional network overload scenarios.

The value of this variable is typically set in configuration files or through the engine’s settings interface. It’s defined as a UPROPERTY with the ‘config’ specifier, indicating that it can be modified in configuration files.

EscalateTimeQuotaMSPerPeriod interacts with several other variables in the RPC DoS detection system, such as EscalateQuotaTimePeriod and EscalateQuotaRPCsPerPeriod. It’s used in calculations to determine if the time spent executing RPCs has exceeded the allowed quota.

Developers must be aware that this variable is part of a complex system for managing network traffic and preventing abuse. Modifying it without understanding the full context of the DoS detection system could lead to either overly restrictive or overly permissive network behavior.

Best practices when using this variable include:

  1. Carefully consider the appropriate value based on your game’s networking requirements.
  2. Test thoroughly after making changes to ensure it doesn’t negatively impact legitimate network traffic.
  3. Use in conjunction with other DoS prevention settings for a comprehensive protection strategy.
  4. Monitor its effectiveness in real-world scenarios and be prepared to adjust as needed.
  5. Document any changes made to this setting for future reference and troubleshooting.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:1736, section: [RPCDoSDetection.Hitch]

Location: <Workspace>/Engine/Config/BaseEngine.ini:1744, section: [RPCDoSDetection.Burst]

Location: <Workspace>/Engine/Config/BaseEngine.ini:1755, section: [RPCDoSDetection.PersistentBurst]

Location: <Workspace>/Engine/Config/BaseEngine.ini:1768, section: [RPCDoSDetection.DoS]

Location: <Workspace>/Engine/Config/BaseEngine.ini:1784, section: [RPCDoSDetection.ExpensiveDoS]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:124

Scope (from outer to inner):

file
function     void FRPCDoSState::ApplyImpliedValues

Source code excerpt:

void FRPCDoSState::ApplyImpliedValues()
{
	EscalateQuotaTimePeriod = (EscalateQuotaRPCsPerPeriod != -1 || EscalateTimeQuotaMSPerPeriod != -1) ? EscalateQuotaTimePeriod : -1;
	RPCRepeatLimitTimePeriod = (RPCRepeatLimitPerPeriod != -1 || RPCRepeatLimitMSPerPeriod != -1) ? RPCRepeatLimitTimePeriod : -1;

	bTrackRecentRPCs = bTrackRecentRPCs || (RPCRepeatLimitPerPeriod != -1 && RPCRepeatLimitTimePeriod != -1);
	EscalateTimeQuotaSecsPerFrame = (EscalateTimeQuotaMSPerFrame != -1 ? (EscalateTimeQuotaMSPerFrame / 1000.0) : 0.0);
	EscalateTimeQuotaSecsPerPeriod = (EscalateTimeQuotaMSPerPeriod != -1 ? (EscalateTimeQuotaMSPerPeriod / 1000.0) : 0.0);
	RPCRepeatLimitSecsPerPeriod = (RPCRepeatLimitMSPerPeriod != -1 ? (RPCRepeatLimitMSPerPeriod / 1000.0) : 0.0);
	EscalationTimeToleranceSeconds = (EscalationTimeToleranceMS != -1 ? (EscalationTimeToleranceMS / 1000.0) : 0.0);
}

bool FRPCDoSState::HasHitQuota_Count(const FRPCDoSCounters(&PerPeriodHistory)[16], FRPCDoSCounters& InFrameCounter) const
{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:176

Scope (from outer to inner):

file
function     bool FRPCDoSState::HasHitQuota_Time

Source code excerpt:

#endif

	if (EscalateTimeQuotaMSPerPeriod > 0 && !bReturnVal)
	{
		const FRPCDoSCounters& PeriodCounter = PerPeriodHistory[EscalateQuotaTimePeriod - 1];

		bReturnVal = (PeriodCounter.AccumRPCTime + InFrameCounter.AccumRPCTime) >= EscalateTimeQuotaSecsPerPeriod;

#if RPC_QUOTA_DEBUG

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:190

Scope (from outer to inner):

file
function     bool FRPCDoSState::HasHitQuota_Time

Source code excerpt:

				(PeriodCounter.AccumRPCTime + InFrameCounter.AccumRPCTime),
				(PeriodCounter.DebugAccumRPCTime + InFrameCounter.DebugAccumRPCTime),
				EscalateTimeQuotaSecsPerPeriod, EscalateTimeQuotaMSPerPeriod);

		UE_CLOG(bReturnVal ^ bDebugReturnVal, LogNet, Warning,
				TEXT("HasHitQuota_Time: Approximate vs Debug Period Quota mismatch: ")
				TEXT("AccumPerPeriodRPCTime: %f, DebugAccumPerPeriodRPCTime: %f, Limit: %f (%i ms)"),
				(PeriodCounter.AccumRPCTime + InFrameCounter.AccumRPCTime),
				(PeriodCounter.DebugAccumRPCTime + InFrameCounter.DebugAccumRPCTime),
				EscalateTimeQuotaSecsPerPeriod, EscalateTimeQuotaMSPerPeriod);
#endif
	}

	return bReturnVal;
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:286

Scope (from outer to inner):

file
function     void FRPCDoSStateConfig::ValidateConfig

Source code excerpt:


	ValidateTimePeriod(EscalateQuotaTimePeriod, TEXT("EscalateQuotaTimePeriod"),
						(EscalateQuotaRPCsPerPeriod > 0 || EscalateTimeQuotaMSPerPeriod > 0));

	ValidateTimePeriod(RPCRepeatLimitTimePeriod, TEXT("RPCRepeatLimitTimePeriod"),
						(RPCRepeatLimitPerPeriod > 0 || RPCRepeatLimitMSPerPeriod > 0));

	if (AutoEscalateTime > 0 && AutoEscalateTime < CooloffTime)
	{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:316

Scope (from outer to inner):

file
function     void FRPCDoSStateConfig::ApplyState

Source code excerpt:

	Target.EscalateTimeQuotaMSPerFrame		= EscalateTimeQuotaMSPerFrame;
	Target.EscalateQuotaRPCsPerPeriod		= EscalateQuotaRPCsPerPeriod;
	Target.EscalateTimeQuotaMSPerPeriod		= EscalateTimeQuotaMSPerPeriod;
	Target.EscalateQuotaTimePeriod			= EscalateQuotaTimePeriod;
	Target.RPCRepeatLimitPerPeriod			= RPCRepeatLimitPerPeriod;
	Target.RPCRepeatLimitMSPerPeriod		= RPCRepeatLimitMSPerPeriod;
	Target.RPCRepeatLimitTimePeriod			= RPCRepeatLimitTimePeriod;
	Target.CooloffTime						= CooloffTime;
	Target.AutoEscalateTime					= AutoEscalateTime;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:204

Scope: file

Source code excerpt:

	/** The amount of time spent executing RPC's per EscalateQuotaPeriod, before the next stage of DoS detection is triggered */
	UPROPERTY(config)
	int16 EscalateTimeQuotaMSPerPeriod	= -1;

	/** The time period to use for determining RPC count and time escalation quotas (Max: 16) */
	UPROPERTY(config)
	int8 EscalateQuotaTimePeriod		= -1;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:251

Scope: file

Source code excerpt:

	double EscalateTimeQuotaSecsPerFrame	= 0.0;

	/** EscalateTimeQuotaMSPerPeriod converted to seconds */
	double EscalateTimeQuotaSecsPerPeriod	= 0.0;

	/** RPCRepeatLimitMSPerPeriod converted to seconds */
	double RPCRepeatLimitSecsPerPeriod		= 0.0;

	/** EscalationTimeToleranceMS converted to seconds */