Skip to content

Commit

Permalink
Fixed server crash when using db* functions during onDebugMessage event
Browse files Browse the repository at this point in the history
  • Loading branch information
ccw808 committed Jul 3, 2016
1 parent bf64085 commit 0866851
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions MTA10_Server/mods/deathmatch/logic/CDatabaseJobQueue.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 );
}
}
Expand Down

0 comments on commit 0866851

Please sign in to comment.