mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/World: Include more details about MaxCoreStuckTime asserts (#28188)
* Core/World: Include more details about MaxCoreStuckTime asserts
Include more details about MaxCoreStuckTime asserts that might help find why FreezeDetector gets triggered with idle MapThreads
* Codestyle fix
(cherry picked from commit de4920de81)
This commit is contained in:
@@ -495,6 +495,11 @@ void WorldUpdateLoop()
|
||||
uint32 realCurrTime = 0;
|
||||
uint32 realPrevTime = getMSTime();
|
||||
|
||||
uint32 maxCoreStuckTime = uint32(sConfigMgr->GetIntDefault("MaxCoreStuckTime", 60)) * 1000;
|
||||
uint32 halfMaxCoreStuckTime = maxCoreStuckTime / 2;
|
||||
if (!halfMaxCoreStuckTime)
|
||||
halfMaxCoreStuckTime = std::numeric_limits<uint32>::max();
|
||||
|
||||
LoginDatabase.WarnAboutSyncQueries(true);
|
||||
CharacterDatabase.WarnAboutSyncQueries(true);
|
||||
WorldDatabase.WarnAboutSyncQueries(true);
|
||||
@@ -509,8 +514,11 @@ void WorldUpdateLoop()
|
||||
uint32 diff = getMSTimeDiff(realPrevTime, realCurrTime);
|
||||
if (diff < minUpdateDiff)
|
||||
{
|
||||
uint32 sleepTime = minUpdateDiff - diff;
|
||||
if (sleepTime >= halfMaxCoreStuckTime)
|
||||
TC_LOG_ERROR("server.worldserver", "WorldUpdateLoop() waiting for %u ms with MaxCoreStuckTime set to %u ms", sleepTime, maxCoreStuckTime);
|
||||
// sleep until enough time passes that we can update all timers
|
||||
std::this_thread::sleep_for(Milliseconds(minUpdateDiff - diff));
|
||||
std::this_thread::sleep_for(Milliseconds(sleepTime));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -553,10 +561,14 @@ void FreezeDetector::Handler(std::weak_ptr<FreezeDetector> freezeDetectorRef, bo
|
||||
freezeDetector->_worldLoopCounter = worldLoopCounter;
|
||||
}
|
||||
// possible freeze
|
||||
else if (getMSTimeDiff(freezeDetector->_lastChangeMsTime, curtime) > freezeDetector->_maxCoreStuckTimeInMs)
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR("server.worldserver", "World Thread hangs, kicking out server!");
|
||||
ABORT();
|
||||
uint32 msTimeDiff = getMSTimeDiff(freezeDetector->_lastChangeMsTime, curtime);
|
||||
if (msTimeDiff > freezeDetector->_maxCoreStuckTimeInMs)
|
||||
{
|
||||
TC_LOG_ERROR("server.worldserver", "World Thread hangs for %u ms, forcing a crash!", msTimeDiff);
|
||||
ABORT_MSG("World Thread hangs for %u ms, forcing a crash!", msTimeDiff);
|
||||
}
|
||||
}
|
||||
|
||||
freezeDetector->_timer.expires_from_now(boost::posix_time::seconds(1));
|
||||
|
||||
Reference in New Issue
Block a user