Dedicated Server taking 10ms when flushing logs to disk.

I’m getting a 10ms lock everytime dedicated servers needs to flush logs in UGameEngine::Tick.

It seems the problem is FAsyncWriter::Flush which in turn calls FAsyncWriter::FlushBuffer.

It will increment the request counter → SerializeRequestCounter.Increment();
And then wait sleeping until the async writer thread decides to wake up and flush the log to disk here:

while (SerializeRequestCounter.GetValue() != 0)
{
	FPlatformProcess::SleepNoStats(0);
}

The thing is , async writer thread runs in FAsyncWriter::Run which which only “wakes up” every 10ms → FPlatformProcess::SleepNoStats(0.01f);

The whole time async writer is sleeping, main thread will be locked, we effectively locking main thread to 10ms every time, even though writing itself may take a few microseconds.

This is very weird, as AsyncWriter will still write logs on its own thread, without locking mainthread, so calling FAsyncWriter::Flush seems really unnecessary, at least for server logs.

Tested on UE 5.6.1-release, but it seems 5.7 made no relevant changes regarding this.

Can anyone confirm? Is it safe to just skip flushing entirely in the UGameEngine::Tick?