Unknown MySQL Problem
#1

Well, Hello.

I have this problem! My server keeps restarting every once and a while due to an error unknown to me. I have checked logs and nothing was a problem there BUT when I had a look at the Debug folder for MySQL I found this everytime the server restarted.

[01:25:29] CMySQLHandler::FreeResult() - The result is already empty.
[01:25:29] >> mysql_store_result( Connection handle: 1 )
[01:25:29] CMySQLHandler::StoreResult() - No data to store.
[01:25:29] >> mysql_free_result( Connection handle: 1 )
[01:25:29] CMySQLHandler::FreeResult() - The result is already empty.
[01:38:52]
[01:38:52] ---------------------------
[01:38:52] MySQL Debugging activated (09/23/11) <<<<<<<Where it Restarts


And also before some of the crashes I found long values like this


[08:36:38] CMySQLHandler::EscapeString(dasdasdasdasesdadadads adadadAsdasdasdasdasdasdasdadad); - Escaped 53 characters to dasdasdasdasesdadadadsadadadAsdasdasdasdasdasdasda dad.
[08:36:38] >> mysql_query( Connection handle: 1 )
[08:36:38] CMySQLHandler::Query(SELECT * FROM `playerinfo` WHERE `user` = '' AND `password` = md5('dasdasdasdasesdadadadsadadadAsdasdasdasdasdas dasdadad')) - Successfully executed.
[08:36:38] >> mysql_store_result( Connection handle: 1 )
[08:36:38] CMySQLHandler::StoreResult() - Result was stored.
[08:36:38] >> mysql_num_rows( Connection handle: 1 )
[08:36:38] CMySQLHandler::NumRows() - Returned 0 row(s)
[08:36:45]
[08:36:45] ---------------------------
[08:36:45] MySQL Debugging activated (10/01/11) <<<<<<Restarts here


Im using the R6 MySQL Plugin by Gystyleez (Or however you spell it)

HELP!! Please!!
Reply
#2

Could we see some code?
Reply
#3

This is my Code in my script which saves and loads playerinfo.

pawn Код:
stock SavePInfo(playerid)
{
    if(GetPVarInt(playerid, "LoggedIN") == 1)
    {
        new Query[600];
       
        format(Query, sizeof(Query), "UPDATE `playerinfo` SET `kills` = %d, `deaths` = %d, `money` = %d, `Level` = %d, `Score` = %d, `VIP` = %d, `Ban` = %d, `Connect` = %d WHERE `user` = '%s'", // Also remember to update this...

        Account[playerid][pKills],
        Account[playerid][pDeaths],
        GetPlayerMoney(playerid),
        Account[playerid][pLevel],
        GetPlayerScore(playerid),
        Account[playerid][pVIP],
        Account[playerid][pBanned],
        Account[playerid][pConnect],
        pName(playerid));

        mysql_query(Query);
        mysql_free_result();
        AvoidOOSync();
        return 1;
    }
    else return 0;
}

stock LoadPlayerInfo(iPlayer)
{
    new Query[700];

    if(mysql_fetch_row(Query))
    {
        sscanf(Query, "p<|>e<s[24]s[35]dddddddd>",Account[iPlayer]);
        mysql_free_result();
    }
    return 1;
}
Do you want more of the debug?
Reply
#4

where are you calling mysql_debug.. your surpose to call it before the first mysql_connect
Reply
#5

Firstly, you're freeing a result that you haven't stored in the first place. Secondly, you're probably starting debug when the script is already debugging. Make sure that you only have mysql_debug(1) once in your script on OnGameModeInit / OnFilterScriptInit.
Reply
#6

I have only called mysql_debug(1) once which is under OnGameModeInit.

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
Firstly, you're freeing a result that you haven't stored in the first place.
The AvoidOOSync(); has this stock

pawn Код:
stock AvoidOOSync()
{
    mysql_store_result();
    mysql_free_result();
    return 1;
}
So should I just remove the mysql_free_result from LoadPlayerInfo(iPlayer) or where?


Also where mysql_debug(1); was put, It was put after mysql_connect. Could this have been the cause?
Reply
#7

Quote:
Originally Posted by Surferdude
Посмотреть сообщение
pawn Код:
stock AvoidOOSync()
{
    mysql_store_result();
    mysql_free_result();
    return 1;
}
I'm not sure but i think if you call that function and you have a result already stored, you will be causing a memory leak. That's probably causing the sql errors too (storing an empty result/trying to free empty result.).
Reply
#8

This has been fixed, How?

AvoidOOSync was stuffing up everything so I have put:

mysql_store_result();
mysql_free_result();

Where Avoid00Sync was.

There was also a problem in the LOGIN area, The mysql_store_result was there but no mysql_free_result.

Thanks for all your help!
Reply
#9

pawn Код:
md5('dasdasdasdasesdadadadsadadadAsdasdasdasdasdas dasdadad'))
I don't think that is the password either. It seems you are storing the value above into the password variable, when instead you should be hashing the password and saving the HASH into the password variable.
Reply
#10

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
pawn Код:
md5('dasdasdasdasesdadadadsadadadAsdasdasdasdasdas dasdadad'))
I don't think that is the password either. It seems you are storing the value above into the password variable, when instead you should be hashing the password and saving the HASH into the password variable.
Ohh, Really? If it were wrong would it still be working?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)