From 086685112eb92830099b7c12f7391cb73f6d346f Mon Sep 17 00:00:00 2001 From: ccw Date: Sun, 3 Jul 2016 19:32:26 +0100 Subject: [PATCH] Fixed server crash when using db* functions during onDebugMessage event --- MTA10_Server/mods/deathmatch/logic/CDatabaseJobQueue.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MTA10_Server/mods/deathmatch/logic/CDatabaseJobQueue.cpp b/MTA10_Server/mods/deathmatch/logic/CDatabaseJobQueue.cpp index 3bd60903d5..7efae56f93 100644 --- a/MTA10_Server/mods/deathmatch/logic/CDatabaseJobQueue.cpp +++ b/MTA10_Server/mods/deathmatch/logic/CDatabaseJobQueue.cpp @@ -327,7 +327,9 @@ void CDatabaseJobQueueImpl::UpdateDebugData ( void ) CTickCount age = timeNow - pJobData->result.timeReady; if ( age.ToLongLong () > 1000 * 60 * 5 ) { + shared.m_Mutex.Unlock (); g_pGame->GetScriptDebugging()->LogWarning( pJobData->m_LuaDebugInfo, "Database result uncollected after 5 minutes. [Query: %s]", *pJobData->command.strData ); + shared.m_Mutex.Lock (); pJobData->result.bLoggedWarning = true; break; } @@ -403,7 +405,9 @@ bool CDatabaseJobQueueImpl::PollCommand ( CDbJobData* pJobData, uint uiTimeout ) // Issue warning if it's taking a long time if ( uiTotalWaitTime > uiWaitTimeWarnThresh ) { + shared.m_Mutex.Unlock (); g_pGame->GetScriptDebugging()->LogWarning( pJobData->m_LuaDebugInfo, "dbPoll is waiting a long time (%d seconds so far). [Query: %s]", uiTotalWaitTime / 1000, *pJobData->command.strData ); + shared.m_Mutex.Lock (); uiWaitTimeWarnThresh += TICKS_FROM_SECONDS( 60 ); } }