Server Freezes / hangs - iLearner - 04.12.2016
Server hangs / stops for a few seconds (by stops i mean, it freezes, everyone including players, chat & irc chat will be frozen)
players cant send msg in chat, cant use cmds. in short whole server freezes. and players packetloss starts to increase slowly even after the thing is over, happens every x minutes (x = random(45)).
profiler plugin doesnt says much, nor i have any amx backtrace in log.... and on playerupdate is:
PHP код:
public OnPlayerUpdate(playerid)
{
lastOPU[playerid] = GetTickCount();
if (isafk_{playerid})
{
UpdateDynamic3DTextLabelText(afklabel[playerid], 0xFFFF00FF," ");
isafk_{playerid} = false;
}
new keys, ud, lr;
GetPlayerKeys(playerid, keys, ud, lr);
if (ud != 0 || lr != 0) ac_vars[playerid][ac_lastudlr] = GetTickCount();
// switch(GetPlayerWeapon(playerid)) { case 44, 45: if((keys & KEY_FIRE) && (!IsPlayerInAnyVehicle(playerid))) return 0; }
return 1;
}
Any solutions?
Re: Server Freezes / hangs -
Logic_ - 04.12.2016
Your OPU still can be improved and optimized, also not always OPU is the main cause of error, there must be something else.
Explain use of these lines in OPU callback?
PHP код:
new keys, ud, lr;
GetPlayerKeys(playerid, keys, ud, lr);
if (ud != 0 || lr != 0) ac_vars[playerid][ac_lastudlr] = GetTickCount();
Re: Server Freezes / hangs -
AnthonyDaBestt - 04.12.2016
well if you upgrade your host you will not have any problem anymore.
Re: Server Freezes / hangs - iLearner - 04.12.2016
Quote:
Originally Posted by AnthonyDaBestt
well if you upgrade your host you will not have any problem anymore.
|
Bitch please! i used to run 2 servers on 1gb ram vps like.. fine!
and for this one the owner purchased a vps with:
PHP код:
2 CPU, 2.5+ GHz Processor
2 GB Ram
120 GB SSD Disk
Transfer Unlimited
1 Gbps Connection
and the problem still exists!
@Ali: idk actually, not my script try to help a friend.
Re: Server Freezes / hangs -
DetoNater - 04.12.2016
the problem is that you should not use this function GetPlayerWeapon in OnplayerUpdate... you should use it some other callback/function I had the same hang issue when i was using killtimer in OnPlayerConnect.... you could use ysi' timer one by using
task globaltimer[1000] // 1 second
{
// switch(GetPlayerWeapon(playerid)) { case 44, 45: if((keys & KEY_FIRE) && (!IsPlayerInAnyVehicle(playerid)))
}
Re: Server Freezes / hangs - iLearner - 04.12.2016
As you see its commented, thus i am not even using it...
Re: Server Freezes / hangs -
oMa37 - 04.12.2016
Infinite loop.
Re: Server Freezes / hangs - iLearner - 04.12.2016
Quote:
Originally Posted by oMa37
Infinite loop.
|
Explain more about it... and how to recognize it.
Re: Server Freezes / hangs -
oMa37 - 04.12.2016
https://sampwiki.blast.hk/wiki/Debugging#Infinite_Loops
Re: Server Freezes / hangs - iLearner - 05.12.2016
But... my server DOES not freeze forever, it only freezes for about 30 seconds and then its back to normal, and then it happens after 30-45 minutes.