Raised This Month: $32 Target: $400
 8% 

[SQL] Threaded Queries freezing server on map change event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rirre
Veteran Member
Join Date: Nov 2006
Old 02-16-2020 , 21:33   [SQL] Threaded Queries freezing server on map change event
Reply With Quote #1

My game server is facing freezing issues with threaded queries in the queue on map change event with my rented MySQL server.

I understand the threaded queries take a bit longer to process when connected to a MySQL server remotely compared to a MySQL on a local/home network, but upon map change event, why doesn't it stop all the threaded queries in the queue at this point?

Video demonstration:


0:00-1:09 is when I'm using my rented MySQL.
1:09-16 is when I'm using a MySQL on my local network.

I used this to reproduce this issue:
Code:
#include <amxmodx> #include <amxmisc> #include <sqlx> new Handle:g_SqlX public plugin_init() {     set_task( 0.1, "sql_init" ) } public sql_init() {     new error[128], errno     SQL_SetAffinity( "mysql" )     g_SqlX = SQL_MakeStdTuple()     new Handle:dbConnect = SQL_Connect( g_SqlX, errno, error, charsmax(error) )     if( dbConnect == Empty_Handle )     {         server_print( "-- DEBUG: ERROR: Cannot connect to SQL!" )         return     }     SQL_FreeHandle(dbConnect) } public plugin_end() {     g_SqlX = Empty_Handle } public client_putinserver(id) {     new szAuthID[35], szIP[16], szQuery[512]     get_user_authid( id, szAuthID, charsmax(szAuthID) )     get_user_ip( id, szIP, charsmax(szIP), 1 )     formatex( szQuery, charsmax(szQuery), "SELECT COUNT(*) FROM `amx_bans` WHERE ((player_id='%s' AND ban_type='S') OR (player_ip='%s' AND ban_type='SI')) AND expired = 1", szAuthID, szIP )     for( new i = 0; i <= 32; i++ ) // Instead of getting 32 players to the server, you can reproduce it with this loop     {         if( g_SqlX )             SQL_ThreadQuery( g_SqlX, "ThreadHandler", szQuery )     }     return PLUGIN_HANDLED; } public ThreadHandler(failstate, Handle:query, error[], errnum, data[], size, Float:queuetime) {     server_print( "-- DEBUG: Resolved query %d, took %f seconds", data[0], queuetime )     if( failstate )     {         if( failstate == TQUERY_CONNECT_FAILED )         {             server_print( "-- DEBUG: Connection failed!" )         }         else if( failstate == TQUERY_QUERY_FAILED )         {             server_print( "-- DEBUG: Query failed!" )         }         server_print("-- DEBUG: Error code: %d (Message: ^"%s^")", errnum, error )         new querystring[512]         SQL_GetQueryString( query, querystring, charsmax(querystring) )         server_print( "-- DEBUG: Original query: %s", querystring )     } }

I have tested this on both Windows (10) and Linux (Ubuntu 18.04.4 LTS) with AMX Mod X 1.9 (build 5263) and AMX Mod X 1.10 (build 5390); no difference.

Last edited by Rirre; 02-17-2020 at 10:03.
Rirre is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode