Infinite Loop Issue. -
Oscii - 21.03.2013
Hello, I have a problem where my test server goes into an infinite loop! It generally happens when I /q So here is my onplayerdisconnect.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
#if defined DEBUG
printf("[debug] OnPlayerDisconnect(%i, %i)", playerid, reason);
#endif
ClearPlayerVars(playerid);
HidePlayerTextDraws(playerid);
Delete3DTextLabel(adminduty[playerid]);
//FadePlayerDisconnect(playerid);
DestroyPlayerProgressBar(playerid, WaterBar[playerid]);
DestroyPlayerProgressBar(playerid, FoodBar[playerid]);
DestroyPlayerProgressBar(playerid, SleepBar[playerid]);
if(accountInformation[playerid][sirenVeh] != -1)
{
accountInformation[playerid][sirenVeh] = -1;
DestroyObject(accountInformation[playerid][sirenObjects][0]);
DestroyObject(accountInformation[playerid][sirenObjects][1]);
}
if(accountInformation[playerid][inSDHeli] == true)
{
accountInformation[playerid][inSDHeli] = false;
for(new i = 0; i < 13; i++)
{
TextDrawHideForPlayer(playerid, Textdraw[playerid][SDHeli][i]);
}
SetCameraBehindPlayer(playerid);
DestroyObject(accountInformation[playerid][SDHeliObj]);
}
switch(reason)
{
case 0: format(Message, sizeof(Message), "{C0C0C0}[ADMIN] %s [%d] has {FFF000}disconnected{C0C0C0} from the server (Timed Out).", RemoveUnderScore(playerid), playerid);
case 1: format(Message, sizeof(Message), "{C0C0C0}[ADMIN] %s [%d] has {FFF000}disconnected{C0C0C0} from the server (Leaving).", RemoveUnderScore(playerid), playerid);
case 2: format(Message, sizeof(Message), "{C0C0C0}[ADMIN] %s [%d] has {FFF000}disconnected{C0C0C0} from the server (Kicked/Banned).", RemoveUnderScore(playerid), playerid);
}
SendToAdmins(Message, COLOR_YELLOW);
GetPlayerHealth(playerid, accountInformation[playerid][health]);
GetPlayerArmour(playerid, accountInformation[playerid][armour]);
for (new i = 0; i < 13; i++) {
GetPlayerWeaponData(playerid, i, accountInformation[playerid][weapon][i], accountInformation[playerid][ammo][i]);
}
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(systemInformation[GMX] == 0) {
saveAccount(playerid, PlayerName);
}
if(accountInformation[playerid][isRentingVeh] == 1)
{
new vid = accountInformation[playerid][rentingVehID];
new gov[100];
format(gov, sizeof(gov), "Government");
vehicleInformation[vid][vehicleOwner] = gov;
}
if(drugSystem[playerid][plantedDrugs] > 0) {
for(new i = 0; i < 6; i++) {
DestroyDynamic3DTextLabel(drugSystem[playerid][label][i]);
DestroyDynamicObject(drugSystem[playerid][object][i]);
drugSystem[playerid][plantedDrugs] = 0;
drugSystem[playerid][dPosX][i] = 0;
drugSystem[playerid][dPosY][i] = 0;
drugSystem[playerid][dPosZ][i] = 0;
drugSystem[playerid][timeStamp][i] = 0;
}
}
return 1;
}
These are the functions that we're in that disconnect function:
pawn Код:
stock HidePlayerTextDraws(playerid)
{
#if defined DEBUG
printf("[debug] HidePlayerTextDraws(%i)", playerid);
#endif
TextDrawDestroy(Textdraw[playerid][vbackground]);
TextDrawDestroy(Textdraw[playerid][vseatbelt]);
TextDrawDestroy(Textdraw[playerid][vseatbeltStatus]);
TextDrawDestroy(Textdraw[playerid][vengine]);
TextDrawDestroy(Textdraw[playerid][vengineStatus]);
TextDrawDestroy(Textdraw[playerid][vlights]);
TextDrawDestroy(Textdraw[playerid][vlightsStatus]);
TextDrawDestroy(Textdraw[playerid][vspeed]);
TextDrawDestroy(Textdraw[playerid][vfuelStatus]);
TextDrawDestroy(Textdraw[playerid][Type]);
TextDrawDestroy(Textdraw[playerid][StopAnim]);
TextDrawDestroy(Textdraw[playerid][To]);
TextDrawDestroy(Textdraw[playerid][StopAnim2]);
TextDrawDestroy(Textdraw[playerid][ANPR]);
TextDrawDestroy(Textdraw[playerid][ANPRPlate]);
TextDrawDestroy(Textdraw[playerid][sFlash]);
TextDrawDestroy(Textdraw[playerid][loginBar][0]);
TextDrawDestroy(Textdraw[playerid][loginBar][1]);
TextDrawDestroy(Textdraw[playerid][WelcomeText][0]);
TextDrawDestroy(Textdraw[playerid][WelcomeText][1]);
TextDrawDestroy(Textdraw[playerid][LoginButton]);
TextDrawDestroy(Textdraw[playerid][QuitButton]);
TextDrawDestroy(Textdraw[playerid][JailText]);
TextDrawDestroy(Textdraw[playerid][JailTimeText]);
TextDrawDestroy(Textdraw[playerid][Clock][0]);
TextDrawDestroy(Textdraw[playerid][Clock][1]);
TextDrawDestroy(Textdraw[playerid][Clock][2]);
for(new i = 0; i < 13; i++)
{
TextDrawDestroy(Textdraw[playerid][SDHeli][i]);
}
}
pawn Код:
stock ClearPlayerVars(playerid)
{
#if defined DEBUG
printf("[debug] ClearPlayerVars(%i)", playerid);
#endif
loggedin[playerid] = 0;
pChances[playerid] = 0;
accountInformation[playerid][hasAccount] = 0;
accountInformation[playerid][loginCheck] = 0;
accountInformation[playerid][hasReported] = false;
accountInformation[playerid][tracker] = false;
accountInformation[playerid][requestedTaxi] = false;
accountInformation[playerid][togglePM] = false;
accountInformation[playerid][finishedTrucking] = false;
accountInformation[playerid][ownsHouse] = false;
accountInformation[playerid][insideHouse] = -1;
accountInformation[playerid][qAnsweredC] = 0;
accountInformation[playerid][inDrivingTest] = 0;
accountInformation[playerid][acceptedDeath] = 0;
accountInformation[playerid][adminDuty] = 0;
accountInformation[playerid][hasDied] = 0;
accountInformation[playerid][inSDHeli] = false;
accountInformation[playerid][SDHeliObj] = -1;
accountInformation[playerid][hasSearched] = false;
accountInformation[playerid][FadePos] = 0;
accountInformation[playerid][adminLevel] = 0;
accountInformation[playerid][editingToys] = false;
accountInformation[playerid][sirenVeh] = -1;
accountInformation[playerid][sirenIndex] = 0;
printf("Done (%s).", RemoveUnderScore(playerid));
return 1;
}
Anything inside that will trigger a infinite loop?
Kind Regards
Oscii
Re: Infinite Loop Issue. -
Misiur - 21.03.2013
No infiloops in here. There are some calls outside though, like saveAccount - look everywhere. Also I suggest using profiler, for infiloop it will return some weird values (with exact location of it)
Re: Infinite Loop Issue. -
StuartD - 21.03.2013
Hello, Thank you for the quick reply, I am from this server, and I have access to the script, so..
Anyways, What is this Profiler you speak of?
Re: Infinite Loop Issue. -
Oscii - 21.03.2013
How would I use profiler to check for infinite loops?
Re: Infinite Loop Issue. -
Misiur - 21.03.2013
https://sampforum.blast.hk/showthread.php?tid=271129 - install it, set output to html, run the server, trigger the "death loop", turn server off - now open the profiler result html file, order by time of execution - there should be some really big execution time (or better yet, a negative one) with exactly pointed out which function takes so much resources.
Re: Infinite Loop Issue. -
Oscii - 21.03.2013
The first one appears to be :
mysql_fetch_field_row
But that is a main SQL loading info I can't really remove that? :S
Re: Infinite Loop Issue. -
Oscii - 21.03.2013
I have also found a few unknown ones called 12000 times!
unknown@00013cc0
Re: Infinite Loop Issue. -
Oscii - 21.03.2013
Been using that profiler, still the server starts an infinite loop somehow
Re: Infinite Loop Issue. -
Jefff - 22.03.2013
Create file pawn.ini write -d3 and save file, put file in pawno folder then compile your .pwn and you will see function name after exit server with profiler plugin