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

SQL_Connect crashing server.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 09-01-2014 , 21:15   SQL_Connect crashing server.
Reply With Quote #1

Code:
#include < amxmodx > #include < sqlx > new Handle:MYSQL_Tuple      = Empty_Handle; new Handle:MYSQL_Connect    = Empty_Handle; public plugin_init( ) {     register_plugin( "New Plug-In", "1.0", "Author" );     MYSQL_Load( ); } public plugin_end( ) {     MYSQL_Close( ); } public MYSQL_Load( ) {     MYSQL_Tuple = SQL_MakeDbTuple( "hostname", "username", "password", "database" );     if( MYSQL_Tuple == Empty_Handle )         return;     new sError[ 512 ], iError;     MYSQL_Connect = SQL_Connect( MYSQL_Tuple, iError, sError, charsmax( sError ) );     if( MYSQL_Connect == Empty_Handle )         set_fail_state( sError ); } public MYSQL_Close( ) {     if( MYSQL_Connect != Empty_Handle )         SQL_FreeHandle( MYSQL_Connect );     if( MYSQL_Tuple != Empty_Handle )         SQL_FreeHandle( MYSQL_Tuple ); }
This code is crashing my server on mapchange. I have no idea what is the problem. There is no error logs.
It's remote database.

Last edited by OvidiuS; 09-01-2014 at 21:19.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 09-01-2014 , 21:28   Re: SQL_Connect crashing server.
Reply With Quote #2

switch to threaded sql
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 09-01-2014 , 21:59   Re: SQL_Connect crashing server.
Reply With Quote #3

Quote:
Originally Posted by aron9forever View Post
switch to threaded sql
That does not explain why is server crashing.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 09-01-2014 , 22:01   Re: SQL_Connect crashing server.
Reply With Quote #4

What testing have you done that makes you believe it is a problem with that plugin?
__________________
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
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 09-01-2014 , 22:08   Re: SQL_Connect crashing server.
Reply With Quote #5

Code:
#include < amxmodx >
#include < sqlx >

new Handle:MYSQL_Tuple      = Empty_Handle
new Handle:MYSQL_Connect    = Empty_Handle

public plugin_init( ) 
{
    register_plugin( "New Plug-In", "1.0", "Author" );
    MYSQL_Load( );
}

public plugin_end( )
{
    MYSQL_Close( )
}

public MYSQL_Load( )
{
    log_to_file( "sql_test.log", "Calling SQL_MakeDbTuple." );

    MYSQL_Tuple = SQL_MakeDbTuple( "hostname", "username", "password", "database" );

    log_to_file( "sql_test.log", "Called SQL_MakeDbTuple." );

    if( MYSQL_Tuple == Empty_Handle )
    {
        log_to_file( "sql_test.log", "Failed to create SQL Tuple" );
        return;
    }

    log_to_file( "sql_test.log", "Created SQL Tuple." );

    new sError[ 512 ], iError;

    log_to_file( "sql_test.log", "Calling SQL_Connect." );

    MYSQL_Connect = SQL_Connect( MYSQL_Tuple, iError, sError, charsmax( sError ) );

    log_to_file( "sql_test.log", "Called SQL_Connect." );

    if( MYSQL_Connect == Empty_Handle )
    {
        log_to_file( "sql_test.log", "Failed to connect: %s", sError );
        return;
    }

    log_to_file( "sql_test.log", "Successfully connected." );
    SQL_FreeHandle( MYSQL_Connect );
}

public MYSQL_Close( )
{
    if( MYSQL_Connect != Empty_Handle )
        SQL_FreeHandle( MYSQL_Connect );

    if( MYSQL_Tuple != Empty_Handle )
        SQL_FreeHandle( MYSQL_Tuple );
}
My log was stuck on "Calling SQL_Connect." I disabled all third party plugins and enabled default amxx plugins. Amxx version i used is 1.8.2.
When using threaded queries log says that connection to database failed. When using plugin posted above, server is crashed.

Maybe there is problem with database i'm using, but still, should whole server crash if sql can't connect to database?

Last edited by OvidiuS; 09-01-2014 at 22:08.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 09-01-2014 , 22:12   Re: SQL_Connect crashing server.
Reply With Quote #6

You have added your address in remote host to allow external conections?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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:48.


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