Raised This Month: $12 Target: $400
 3% 

'SQL server down' = 'game server down'


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Maurice
Senior Member
Join Date: Nov 2006
Location: Netherlands
Old 02-02-2009 , 18:13   'SQL server down' = 'game server down'
Reply With Quote #1

We use AMXBans to control the admins and and banned players but sometimes the server wich store the mysql database goes offline. Not yet a real problem althought connecting players who are banned won't be blocked anymore and connecting admins won't get their rights anymore. The problem is when the game server change from level the game server crash.

Anyone know how to prevent this game server crashes or is the only way just keeping the SQL server 24/7365 days online?
__________________
Luck? Luck is only one feeling of amazement concerning a seemingly incidental circumstance which one himself must create.
Maurice is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 02-03-2009 , 04:33   Re: 'SQL server down' = 'game server down'
Reply With Quote #2

Yes, this is a huge problem. If mysql server is offline, amxbans will freeze server at mapchange (pff, a 1-2 seconds before change level).

I have 8 servers and only one database, and my database server like be offline ;D so I bought better server, with ~99.5 precentage of online.

But this is no a solution...

Look into amxbans.sma
Code:
public plugin_end()
{
    SQL_FreeHandle(g_SqlX)
}
Plugin want to remove handle, but isnt connected to database... I believe you can remove this code - handle is removed at every mapchange, or better way - check if connection to database was failed, if yes - dont free handle (failed) connection.
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
Maurice
Senior Member
Join Date: Nov 2006
Location: Netherlands
Old 02-03-2009 , 14:23   Re: 'SQL server down' = 'game server down'
Reply With Quote #3

Thanks for the reply and idea. I don't know how to script the plugin first checks if a connection to the SQL database is possible but the idea to remove the 'remove handle' part form the plugin i can. The only question is what happends if the handle won't removed at every map change?
__________________
Luck? Luck is only one feeling of amazement concerning a seemingly incidental circumstance which one himself must create.
Maurice is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 02-04-2009 , 04:56   Re: 'SQL server down' = 'game server down'
Reply With Quote #4

Quote:
The only question is what happends if the handle won't removed at every map change?
Just test.

I believe nothing ;) Why? Because after mapchange all plugins are reloaded, so all variables (sql handle also) are cleared.

But this may cause problems with sql database (connection didnt close).

Try this
Code:
public plugin_end()
{
    if(g_SqlX > 0)
        SQL_FreeHandle(g_SqlX)
}
But I dont know what is a value of handler when connecting to database was successfull, so this can be wrong. Sorry, I dont have enough spare time.
__________________
Join US - custom Zombie Server - Custom Addons:




Last edited by Sn!ff3r; 02-04-2009 at 05:02.
Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-04-2009 , 10:13   Re: 'SQL server down' = 'game server down'
Reply With Quote #5

Quote:
Originally Posted by Sn!ff3r View Post
Try this
Code:
public plugin_end()
{
    if(g_SqlX)
        SQL_FreeHandle(g_SqlX)
}
No need to compare, if it is any value other than 0, it is evaluated to true. Better yet, don't even do the if, just free it.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-04-2009 , 10:14   Re: 'SQL server down' = 'game server down'
Reply With Quote #6

Quote:
Originally Posted by Sn!ff3r View Post
Just test.

I believe nothing ;) Why? Because after mapchange all plugins are reloaded, so all variables (sql handle also) are cleared.

But this may cause problems with sql database (connection didnt close).

Try this
Code:
public plugin_end()
{
    if(g_SqlX > 0)
        SQL_FreeHandle(g_SqlX)
}
But I dont know what is a value of handler when connecting to database was successfull, so this can be wrong. Sorry, I dont have enough spare time.
I don't really know the problem, but the proper way to write the above code would be:

Code:
public plugin_end() if(g_SqlX != Empty_Handle) SQL_FreeHandle(g_SqlX)
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
BAILOPAN
Join Date: Jan 2004
Old 02-04-2009 , 10:58   Re: 'SQL server down' = 'game server down'
Reply With Quote #7

This is truly a surprise: when a service goes down you can't use it anymore.

The real question is: why is the service going offline?
__________________
egg
BAILOPAN is offline
Maurice
Senior Member
Join Date: Nov 2006
Location: Netherlands
Old 02-04-2009 , 19:44   Re: 'SQL server down' = 'game server down'
Reply With Quote #8

Thanks all for the help! I will try as first Hawk's code.
Code:
public plugin_end() if(g_SqlX != Empty_Handle) SQL_FreeHandle(g_SqlX)
Quote:
Originally Posted by BAILOPAN View Post
This is truly a surprise: when a service goes down you can't use it anymore.

The real question is: why is the service going offline?
Keeping a server 24/7/365 online will not be the easiest thing to do specialy not when it is shared with alot of users. I pay around the 4 euro's per month for the amxbans and a simple forum hosting and in the last 6 months it went 2 times offline for some hours. It's acceptable for that price and if i can add a changement in the amxbans plugin code so the game server dont crash when the amxbans database is offline it would be fantastic! Ofcourse i can rent a VPS or even a root server wich hopefuly give me a 100% uptime but i don't want to pay a price of 20 to 50 euro's p/m just only for hosting amxbans.
__________________
Luck? Luck is only one feeling of amazement concerning a seemingly incidental circumstance which one himself must create.
Maurice is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 02-05-2009 , 02:15   Re: 'SQL server down' = 'game server down'
Reply With Quote #9

Quote:
I don't really know the problem, but the proper way to write the above code would be:
If mysql server doesnt respond, server will freeze at mapchange.

Maurice, can you test it (for example, compile new code and change in sql.ini ip address to wrong)?
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
Maurice
Senior Member
Join Date: Nov 2006
Location: Netherlands
Old 02-05-2009 , 11:48   Re: 'SQL server down' = 'game server down'
Reply With Quote #10

Thanks for the tip sn!ff3r about changing the ip in the sql.cfg, this maded testing very easy.

To bad none of the codes prevented the freeze of the game server when the amxbans database wasn't accessible at map change. When the server could connect again to the database (changed the ip in the sql.cfg) the server went online but i had no acces to amxmodmenu while i had the right admin flags, i checked it with amx_who. After i changed the map with rcon acces i had again acces to amxmodmenu. Proberly this is due the removal of the 'SQL_FreeHandle(g_SqlX)' part.

It seems the SQL servers just have to be 24/7/365 online to prevent this servers freezes at map change. Thanks again all for the help it was really worth to try it because i think i aint the only one with this problem.
__________________
Luck? Luck is only one feeling of amazement concerning a seemingly incidental circumstance which one himself must create.
Maurice is offline
Reply



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 07:32.


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