SA-MP Forums Archive
[Dangerous!]streamer will cause mysql-plugin R7 out of heap and then lead the sever down - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Dangerous!]streamer will cause mysql-plugin R7 out of heap and then lead the sever down (/showthread.php?tid=379820)



[Dangerous!]Load streamer and mysql-plugin R7 together will cause out of heap and then lead the sever down - nobita - 23.09.2012

Load streamer and mysql-plugin R7 together will cause out of heap and then lead the sever down

My sever would goes wrong at random times with the information
Код:
mysql.dll [00c0a112] is releasing memory at 00bc7151 which is out of heap
[15:57:17] [debug] System backtrace:
[15:57:17] [debug] #0 1001fe3c in ?? () from D:\new2\test\plugins\crashdetect.dll
[15:57:17] [debug] #1 10020720 in ?? () from D:\new2\test\plugins\crashdetect.dll
[15:57:17] [debug] #2 10023c97 in ?? () from D:\new2\test\plugins\crashdetect.dll
[15:57:17] [debug] #3 00c4a112 in ProcessTick () from D:\new2\test\plugins\mysql.dll
[15:57:17] [debug] #4 00469da6 in ?? () from D:\new2\test\samp-server.exe
[15:57:17] [debug] #5 ff006aec in ?? ()
And many other guys on the forum have faced this problem too! Like this https://sampforum.blast.hk/showthread.php?tid=360559 https://sampforum.blast.hk/showthread.php?tid=368396
https://sampforum.blast.hk/showthread.php?tid=379511
It take me days to find out that the Streamer plugin causes this!
whenever I load the Streamer , This error comes up!!!!
And if I remove the Streamer, everything gose well!!!

By the way. you need the crashdetect plugin to see the error information, or the sever would just go no response with unknown error!
The Streamer plugin I tested is the newest version 2.6.1,(not the 1000p editon)
Could anyone solve this problem?

If you don't believe this. This is a testing code.
Код:
#include <a_samp>
#include <core>
#include <float>
#include <time>
#include <file>
#include <utils>
#include <a_mysql>
#include <foreach>
#include <streamer>
new GName[50];
new ID;
new DBHandle;
main()
{
	print("Hello!");
}
public OnGameModeInit()
{
	DBHandle = mysql_connect("sqlhost", "sqluser","sqldb","sqlpass");
	SetTimer("MYSQLUpdate",100,1); //I set this timer so quick to let the errors come up quickly.That saves the testing time!
}


forward MYSQLUpdate();
public MYSQLUpdate()
{
	mysql_function_query(DBHandle, "SELECT * FROM `testtable` ORDER BY `id` ", true, "onMYSQLUpdate", "", "");
	return 1;
}
forward onMYSQLUpdate();
public onMYSQLUpdate()
{
	new rows,fields;
	cache_get_data(rows, fields);
	for(new i=0; i < rows ; i++){
	cache_get_field_content(i, "id", GName), ID = strval(GName);
	}
	//printf("Num : %d--%d",rows,ID);
	return 1;
}

//This code is very simple, so "out of heap" dosent's cause immediately crash it just have bug
 reports and the code gose on. But if the sever have one players, it gose no response at once. 



Re: [Dangerous!]streamer will cause mysql-plugin R7 out of heap and then lead the sever down - ReneG - 23.09.2012

I want to know how this compiled
pawn Код:
cache_get_field_content(i, "id", GName), ID = strval(GName);



Re: [Dangerous!]streamer will cause mysql-plugin R7 out of heap and then lead the sever down - nobita - 23.09.2012

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
I want to know how this compiled
pawn Код:
cache_get_field_content(i, "id", GName), ID = strval(GName);
sorry, I deleted the "new ID" together with my sql password when I post this thread. that's not the point.


Re: [Dangerous!]streamer will cause mysql-plugin R7 out of heap and then lead the sever down - ReneG - 23.09.2012

That's not what I mean, in Pawn, everytime you call a function, it has to be followed by a semicolon.

It's
pawn Код:
cache_get_field_content(i, "id", GName);
not
pawn Код:
cache_get_field_content(i, "id", GName),
and you don't need "new ID" because ID is defined at the top as a global variable.

Also, enable debugging with mysql_debug(1); in OnGameModeInit, start your script and afterwards, look in mysql_log.txt in your server directory, and see what it says. You might not even be connected to the database.

One more thing in the MYSQLUpdate function, you're using mysql_function_query wrong.
It's supposed to be
pawn Код:
public MYSQLUpdate()
{
    mysql_function_query(DBHandle, "SELECT * FROM `testtable` ORDER BY `id` ", true, "onMYSQLUpdate", "");
    return 1;
}



Re: [Dangerous!]streamer will cause mysql-plugin R7 out of heap and then lead the sever down - Psymetrix - 23.09.2012

@VincentDunn: using commas to seperate functions on one line is (i believe) the correct way.

E.g:
pawn Код:
public MYSQLUpdate()
{
    return mysql_function_query(DBHandle, "SELECT * FROM `testtable` ORDER BY `id` ", true, "onMYSQLUpdate", ""), 1;
}
That function will return 1.


Re: [Dangerous!]streamer will cause mysql-plugin R7 out of heap and then lead the sever down - nobita - 23.09.2012

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
That's not what I mean, in Pawn, everytime you call a function, it has to be followed by a semicolon.

It's
pawn Код:
cache_get_field_content(i, "id", GName);
not
pawn Код:
cache_get_field_content(i, "id", GName),
and you don't need "new ID" because ID is defined at the top as a global variable.

Also, enable debugging with mysql_debug(1); in OnGameModeInit, start your script and afterwards, look in mysql_log.txt in your server directory, and see what it says. You might not even be connected to the database.

One more thing in the MYSQLUpdate function, you're using mysql_function_query wrong.
It's supposed to be
pawn Код:
public MYSQLUpdate()
{
    mysql_function_query(DBHandle, "SELECT * FROM `testtable` ORDER BY `id` ", true, "onMYSQLUpdate", "");
    return 1;
}
No No No that's all not the point. My code is all right, you can see the Tutorial https://sampforum.blast.hk/showthread.php?tid=337810

I have testing days before I posted this, I also know the debug, otherwise how did I know when the query stoped?
The point is the streamer and R7! not my code.


Re: [Dangerous!]streamer will cause mysql-plugin R7 out of heap and then lead the sever down - ReneG - 23.09.2012

Quote:
Originally Posted by Psymetrix
Посмотреть сообщение
@VincentDunn: using commas to seperate functions on one line is (i believe) the correct way.

E.g:
pawn Код:
public MYSQLUpdate()
{
    return mysql_function_query(DBHandle, "SELECT * FROM `testtable` ORDER BY `id` ", true, "onMYSQLUpdate", ""), 1;
}
That function will return 1.
I learned something new today.

OP, post the last tasks your server_log reads


Re: [Dangerous!]streamer will cause mysql-plugin R7 out of heap and then lead the sever down - nobita - 23.09.2012

Quote:
Originally Posted by Psymetrix
Посмотреть сообщение
@VincentDunn: using commas to seperate functions on one line is (i believe) the correct way.

E.g:
pawn Код:
public MYSQLUpdate()
{
    return mysql_function_query(DBHandle, "SELECT * FROM `testtable` ORDER BY `id` ", true, "onMYSQLUpdate", ""), 1;
}
That function will return 1.
Yes, you are right, Thank you!
I'v tested days to find the problem. I can't did this mistake.

If the sever querys very seldom, it may maintain a day. but if it query quickly, it will down very soon, and with no reason ,It's hard to find this problem.


Re: [Dangerous!]streamer will cause mysql-plugin R7 out of heap and then lead the sever down - nobita - 23.09.2012

Quote:
Originally Posted by ******
Посмотреть сообщение
But does this not happen if you don't load the mySQL plugin instead? Blaming this on one of them when you haven't tried the other is just wrong. What's more, removing the one that doesn't have built-in equivalent functions is just silly.
thank you, I known this. my subject is "Load streamer and mysql-plugin R7 together will cause out of heap and then lead the sever down". I have changed this long before, but the forum's cache didn't change

by the way. what is ""REP+""?


Re: [Dangerous!]streamer will cause mysql-plugin R7 out of heap and then lead the sever down - nobita - 23.09.2012

Quote:
Originally Posted by ******
Посмотреть сообщение
Ok, well you have three options:

1) Both plugins are open-source, so find and fix the bug.
2) Remove the streamer plugin and write a streamer in pawn.
3) Remove the mySQL plugin and loose nothing - there is another one and built-in database functions.
well, thank you, they are hard things for me...