net.NetFaultRecoveryLogQuotaChecks

net.NetFaultRecoveryLogQuotaChecks

#Overview

name: net.NetFaultRecoveryLogQuotaChecks

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of net.NetFaultRecoveryLogQuotaChecks is to enable debug logging for quota checks in the network fault recovery system of Unreal Engine 5. This setting is particularly useful for debugging new network faults used with the ‘RegisterCounterCategory’ function.

This setting variable is primarily used in the networking subsystem of Unreal Engine 5, specifically in the network fault recovery module. It’s part of the Net Core system, as evidenced by its location in the NetConnectionFaultRecoveryBase.cpp file.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.

The associated variable GNetFaultRecoveryLogQuotaChecks interacts directly with net.NetFaultRecoveryLogQuotaChecks. They share the same value, with GNetFaultRecoveryLogQuotaChecks being the actual int32 variable used in the code, while net.NetFaultRecoveryLogQuotaChecks is the console variable name used to control it.

Developers must be aware that this variable is only available in non-shipping builds (#if !UE_BUILD_SHIPPING). It’s intended for debugging purposes and won’t be accessible in release builds.

Best practices when using this variable include:

  1. Only enable it when actively debugging network fault issues.
  2. Be cautious about performance implications when enabled, as it may generate additional log output.
  3. Use it in conjunction with the ‘RegisterCounterCategory’ function when implementing new network fault types.

Regarding the associated variable GNetFaultRecoveryLogQuotaChecks:

The purpose of GNetFaultRecoveryLogQuotaChecks is to serve as the actual boolean flag that controls whether debug logging for quota checks is enabled.

This variable is used directly in the networking subsystem’s fault recovery logic. It’s checked in the FNetFaultState::HasHitAnyQuota function to determine whether to log detailed information about quota checks.

The value of GNetFaultRecoveryLogQuotaChecks is set indirectly through the console variable system, via net.NetFaultRecoveryLogQuotaChecks.

No other variables directly interact with GNetFaultRecoveryLogQuotaChecks, but it’s used to control the output of debug logging in the quota check system.

Developers should be aware that this variable is a performance-sensitive flag. When enabled, it will cause additional logging, which could impact performance, especially in scenarios with frequent network faults.

Best practices for using GNetFaultRecoveryLogQuotaChecks include:

  1. Only enable it in development or debugging scenarios, never in production.
  2. Use it temporarily when investigating specific network fault issues.
  3. Remember to disable it after debugging to avoid unnecessary performance overhead.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Net/Core/Private/Net/Core/Connection/NetConnectionFaultRecoveryBase.cpp:13

Scope: file

Source code excerpt:


FAutoConsoleVariableRef GNetFaultRecoveryLogQuotaChecksCVar(
	TEXT("net.NetFaultRecoveryLogQuotaChecks"),
	GNetFaultRecoveryLogQuotaChecks,
	TEXT("Whether or not to enable debug logging for quota checks (useful for debugging new net faults used with 'RegisterCounterCategory')"));
#endif


/**

#Associated Variable and Callsites

This variable is associated with another variable named GNetFaultRecoveryLogQuotaChecks. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Net/Core/Private/Net/Core/Connection/NetConnectionFaultRecoveryBase.cpp:10

Scope: file

Source code excerpt:

// CVars
#if !UE_BUILD_SHIPPING
static int32 GNetFaultRecoveryLogQuotaChecks = false;

FAutoConsoleVariableRef GNetFaultRecoveryLogQuotaChecksCVar(
	TEXT("net.NetFaultRecoveryLogQuotaChecks"),
	GNetFaultRecoveryLogQuotaChecks,
	TEXT("Whether or not to enable debug logging for quota checks (useful for debugging new net faults used with 'RegisterCounterCategory')"));
#endif


/**
 * FNetFaultState

#Loc: <Workspace>/Engine/Source/Runtime/Net/Core/Private/Net/Core/Connection/NetConnectionFaultRecoveryBase.cpp:175

Scope (from outer to inner):

file
function     bool FNetFaultState::HasHitAnyQuota

Source code excerpt:


#if !UE_BUILD_SHIPPING
			if (GNetFaultRecoveryLogQuotaChecks)
			{
				const double HighestFaultPercentage = (FullPacketCount > 0 ? (double)HighestFaultCount / (double)FullPacketCount : 0.0) * 100.0;

				UE_LOG(LogNetCore, Log, TEXT("FNetFaultState::HasHitAnyQuota: bReturnVal: %i, bEscalateQuota: %i, FullPacketCount: %i, ")
						TEXT("HighestFaultCount: %i, QuotaFaultsPerPeriod: %i, QuotaFaultPercentPerPeriod: %i, HighestFaultPercentage: %f"),
						(int32)bReturnVal, (int32)bEscalateQuota, FullPacketCount, HighestFaultCount, QuotaFaultsPerPeriod,