View Single Post
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 07-25-2021 , 08:12   Re: MySQL connection loss leads to crashes
Reply With Quote #5

I investigated the problem and found out that, the crashes happen after any of the plugins using MySQL are reloaded. Looks like after a plugin is reloaded, it can't any longer exectue SQL queries in a separate thread and all quaries are executed in the main thread.

I guess eather
PHP Code:
pPlugin->GetProperty("DisallowDBThreads"NULL
or
PHP Code:
!g_DBMan.AddToThreadQueue(opPrioQueue_High
returns true for reloaded plugins.

To test my assumption I created a reloader plugin. It reloads all plugins when map changes.
If there are no plugins using MySQL - everything is fine, but when I add one, the server goes to boot loop (if the MySQL server is switched off).

The problem might be in (DBManager::OnPluginWillUnload):
https://github.com/alliedmodders/sou...c/Database.cpp
Also it might switch unfinished threaded queries to non-threaded and block the main thread... not sure if it works this way though.

Is it a bug ?
Attached Files
File Type: sp Get Plugin or Get Source (reloader.sp - 129 views - 1.4 KB)

Last edited by kadet.89; 07-25-2021 at 08:53.
kadet.89 is offline
Send a message via Skype™ to kadet.89