Raised This Month: $ Target: $400
 0% 

Project in jeopardy (SQLx issue)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
alien
Senior Member
Join Date: Aug 2005
Location: London || Slovakia
Old 12-13-2007 , 23:00   Project in jeopardy (SQLx issue)
Reply With Quote #1

Hi,

I've spent 5 months building vast AMXX / web interface for climbing / cups and everything else regarding KZ maps. Plugin part is now 7 thousand lines long and is estimated to be finished by 90%. This plugin was supposed to be implemented into xtreme-jumps.eu servers - the official international KZ community. All of this is based on true power of SQL ... and therefore, I'm using SQLx with 99% of queries processed thread-wise.

But there is one problem standing in a way of going live with this project: The servers crash and they do quite often. I took 2 weeks to check source code for possible causes and I did find some ... but with no apparent improvement. It seemed, that server crashes upon threaded query execution / handling.

I've made a simple plugin:

Code:
#include <amxmodx> #include <sqlx> #define PLUGIN_NAME "SQLx Test Plugin" #define PLUGIN_VERSION "12.12.02" #define PLUGIN_AUTHOR "A    L    |    E    N" #define DB_HOST "*******" #define DB_USER "*******" #define DB_PASSWORD "*******" #define DB_SCHEMA "*******" new     Handle:_DB_TUPLE,     n; public plugin_init()     {         register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);         _DB_TUPLE = SQL_MakeDbTuple(DB_HOST, DB_USER, DB_PASSWORD, DB_SCHEMA);                 register_concmd("run_test", "run_test");                 return PLUGIN_CONTINUE;     }     public run_test()     {         server_print(">> query -- %d", ++n);                 SQL_ThreadQuery(_DB_TUPLE, "run_test_handler", "SELECT 1 + 1");                 return PLUGIN_HANDLED;     }     public run_test_handler(fail_state, Handle:query, error[], error_code, handler_data[], handler_data_size)     {         server_print("<< handler -- %d", --n);                 return PLUGIN_CONTINUE;     }

I played around with run_test command, calling it randomly. As you can see from the source code, n indicates number of queries to waiting for handler. Sometimes, it was possible to fill the queue with 500 queries without crashing but mostly, I was not able to get over 20.

These are various console printouts upon crash:

Quote:
>> query -- 1
>> query -- 2
>> query -- 3
>> query -- 4
>> query -- 5
>> query -- 6
>> query -- 7
<< handler -- 6
>> query -- 7
>> query -- 8
./hlds_run: line 344: 27691 Segmentation fault (core dumped) $HL_CMD
Cannot access memory at address 0xb7f716b8
Cannot access memory at address 0xbfc71ae0
/servery/j2s_dev/debug.cmds: Error in sourced command file:
Cannot access memory at address 0xb7f716b8
email debug.log to [email protected]
Thu Dec 13 17:404 CET 2007: Server restart in 10 seconds
Here, I wasn't even able to execute 3 queries w/o dropping my server:

Quote:
>> query -- 1
>> query -- 2
>> query -- 3
<< handler -- 2
<< handler -- 1
./hlds_run: line 344: 27778 Segmentation fault (core dumped) $HL_CMD
Cannot access memory at address 0xb7f716b8
Cannot access memory at address 0xbfc71ae0
/servery/j2s_dev/debug.cmds: Error in sourced command file:
Cannot access memory at address 0xb7f716b8
email debug.log to [email protected]
Thu Dec 13 18:02:41 CET 2007: Server restart in 10 seconds
I think that thread nature of SQLx is the problem here. Running static queries even frequently does no harm. And there is something interesting in debug.log:

Quote:
CRASH: Thu Dec 13 22:54:00 CET 2007
Start Line: ./hlds_amd -game cstrike -port 27015 +maxplayers 12 +map kz_ea_dam +servercfgfile server.cfg +motdfile motd.txt +
Using host libthread_db library "/lib/libthread_db.so.1".
#0 0xb4eac9be in ?? ()
No symbol table info available.
End of crash report
I tried to update with new glibc but it didn't help.

Now: I've moved to another server running same version of Gentoo Linux and there was no problem at all. I did few extreme tests putting 500 queries into queue and waiting for them to execute. It worked! But it doesn't now and I have no idea why.

Only change I did to the system was proftpd installation.
Anyone with experience to share? This is rendering threaded SQLx pretty useless for me ... and rebuilding whole thing to static queries sounds like ... well.

Thank you in forward.
A
__________________
alien is offline
Send a message via ICQ to alien
 



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 11:01.


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