Server Freezes / hangs
#1

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 
keysudlr;
    
GetPlayerKeys(playeridkeysudlr);
    if (
ud != || lr != 0ac_vars[playerid][ac_lastudlr] = GetTickCount();
   
// switch(GetPlayerWeapon(playerid)) { case 44, 45: if((keys & KEY_FIRE) && (!IsPlayerInAnyVehicle(playerid))) return 0; }
    
return 1;

Any solutions?
Reply
#2

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 keysudlr
GetPlayerKeys(playeridkeysudlr); 
if (
ud != || lr != 0ac_vars[playerid][ac_lastudlr] = GetTickCount(); 
Reply
#3

well if you upgrade your host you will not have any problem anymore.
Reply
#4

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 CPU2.5GHz 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.
Reply
#5

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)))
}
Reply
#6

As you see its commented, thus i am not even using it...
Reply
#7

Infinite loop.
Reply
#8

Quote:
Originally Posted by oMa37
Посмотреть сообщение
Infinite loop.
Explain more about it... and how to recognize it.
Reply
#9

https://sampwiki.blast.hk/wiki/Debugging#Infinite_Loops
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)