Server uses 100% CPU -
Su37Erich - 08.05.2015
Hello,
Few days ago my server started to stay frozen using 100% CPU.
I don't figure what could be, it didn't happen before, so I'm asking if there is a new kind of "exploit" that freezes the server like in 0.3x (I'm using 0.3.7)
https://sampforum.blast.hk/showthread.php?tid=485833
I've some infinite loops but I don't think that are the problem:
PHP код:
for(;;)
{
rand1 = random(2800);
rand2 = random(2800);
less1 = random(2);
less2 = random(2);
if(less1 == 0)
rand1 = -rand1;
if(less2 == 0)
rand2 = -rand2;
MapAndreas_FindZ_For2DCoord(rand1, rand2, z);
if(z > 0.0)
break;
else fail++;
if(fail > 50)
{
print("Map andreas isn't working");
return 0;
}
}
PHP код:
new const dir[19] = {0, 50, 150, 300, 600, 1000, 1500, 2100, 2800, 3600, 5000, 10000, 16000, 22000, 33000, 44000, 55000, 70000, 100000};
new li = 0;
new ls = 19;
new div;
if(ScoreRank >= 0)
{
for(;;)
{
div = (li+ls)/2;
if(div >= 18)
break;
if(ScoreRank >= dir[div] && ScoreRank < dir[div+1])
break;
else if(ScoreRank < dir[div])
ls = div;
else
li = div;
}
}
And that are all infinite loops that I have.
This happens when the server get freezed:
[14:24:04] [connection] 167.0.26.147:57826 requests connection cookie.
[14:24:32] Kicking 201.254.169.173 because they didn't logon to the game.
[14:24:35] Kicking 186.16.179.122 because they didn't logon to the game.
[14:24:35] Kicking 167.0.26.147 because they didn't logon to the game.
[14:25:09] [connection] 89.3.255.86:64817 requests connection cookie.
[14:25:37] [connection] 170.51.71.37:17536 requests connection cookie.
[14:25:40] Kicking 89.3.255.86 because they didn't logon to the game.
[14:25:58] [connection] 190.30.69.169:17318 requests connection cookie.
[14:26:29] Kicking 190.30.69.169 because they didn't logon to the game.
[14:27:42] [connection] 186.89.210.25:64449 requests connection cookie.
[14:28:13] Kicking 186.89.210.25 because they didn't logon to the game.
[14:28:50] [connection] 186.89.210.25:50990 requests connection cookie.
[14:29:21] Kicking 186.89.210.25 because they didn't logon to the game.
[14:30:25] [connection] 187.184.222.174:59283 requests connection cookie.
[14:30:44] [connection] 170.51.71.37:64110 requests connection cookie.
[14:30:45] [connection] 170.51.71.37:64110 requests connection cookie.
[14:30:56] Kicking 187.184.222.174 because they didn't logon to the game.
[14:31:55] [connection] 200.5.75.2:57652 requests connection cookie.
[14:31:58] [connection] 186.89.210.25:53980 requests connection cookie.
[14:32:26] Kicking 200.5.75.2 because they didn't logon to the game.
Thank you if you could submit some useful information!
Re: Server uses 100% CPU -
Marricio - 08.05.2015
I don't understand what you're trying to achieve in that loop, however, you can try commenting it then test if it freezes again.
Also, check your timers and OnPlayerUpdate callback.
Re: Server uses 100% CPU -
J4Rr3x - 08.05.2015
Have you tried to delete this infinite loops and see if it freeze again?
Re: Server uses 100% CPU -
Su37Erich - 08.05.2015
It didn't happen before, the first loop searches for a random position of the map that is not water, if it is water the loop will continue searching until the Z position is higher than zero, if it searches for more than 50 times and always the function return 0.0, the script will break the loop using a return 0; So that isn't the problem, impossible I think, isn't it?
Second loop is a binary search algorithm, it's called every time the player send a message
I am 99.99% sure is not my script, I think it is something else
Re: Server uses 100% CPU -
Marricio - 08.05.2015
Use this plugin, if it's your script it will help you a lot to find you whats causing this problem.
Perfomance Profiler
Re: Server uses 100% CPU -
Su37Erich - 08.05.2015
Thank you, I'll try to use it, because months ago it didn't worked for me, it's a bit complex to install, anyway I'll install crashdetect plugin and wait if someone could have information of a new exploit.
Re: Server uses 100% CPU -
PowerPC603 - 08.05.2015
Or just put a printf statement inside your infinite loops that prints something unique to your server-console, like
pawn Код:
printf("Executing infinite loop 1");
or
printf("Executing infinite loop 2");
Then, if your server freezes again and it keeps printing those lines, you know where to look.
Preferably, add a counter value after the text, because printing the same thing over and over again won't notify you as you don't see it scrolling.
pawn Код:
// At top of script
new LoopCounter1, LoopCounter2;
printf("Executing infinite loop 1: %i", LoopCounter1);
LoopCounter1++;
printf("Executing infinite loop 2: %i", LoopCounter2);
LoopCounter2++;
Re: Server uses 100% CPU -
pivetesgames - 08.05.2015
Quote:
Originally Posted by Su37Erich
Hello,
Few days ago my server started to stay frozen using 100% CPU.
I don't figure what could be, it didn't happen before, so I'm asking if there is a new kind of "exploit" that freezes the server like in 0.3x (I'm using 0.3.7)
https://sampforum.blast.hk/showthread.php?tid=485833
I've some infinite loops but I don't think that are the problem:
PHP код:
for(;;)
{
rand1 = random(2800);
rand2 = random(2800);
less1 = random(2);
less2 = random(2);
if(less1 == 0)
rand1 = -rand1;
if(less2 == 0)
rand2 = -rand2;
MapAndreas_FindZ_For2DCoord(rand1, rand2, z);
if(z > 0.0)
break;
else fail++;
if(fail > 50)
{
print("Map andreas isn't working");
return 0;
}
}
PHP код:
new const dir[19] = {0, 50, 150, 300, 600, 1000, 1500, 2100, 2800, 3600, 5000, 10000, 16000, 22000, 33000, 44000, 55000, 70000, 100000};
new li = 0;
new ls = 19;
new div;
if(ScoreRank >= 0)
{
for(;;)
{
div = (li+ls)/2;
if(div >= 18)
break;
if(ScoreRank >= dir[div] && ScoreRank < dir[div+1])
break;
else if(ScoreRank < dir[div])
ls = div;
else
li = div;
}
}
And that are all infinite loops that I have.
This happens when the server get freezed:
[14:24:04] [connection] 167.0.26.147:57826 requests connection cookie.
[14:24:32] Kicking 201.254.169.173 because they didn't logon to the game.
[14:24:35] Kicking 186.16.179.122 because they didn't logon to the game.
[14:24:35] Kicking 167.0.26.147 because they didn't logon to the game.
[14:25:09] [connection] 89.3.255.86:64817 requests connection cookie.
[14:25:37] [connection] 170.51.71.37:17536 requests connection cookie.
[14:25:40] Kicking 89.3.255.86 because they didn't logon to the game.
[14:25:58] [connection] 190.30.69.169:17318 requests connection cookie.
[14:26:29] Kicking 190.30.69.169 because they didn't logon to the game.
[14:27:42] [connection] 186.89.210.25:64449 requests connection cookie.
[14:28:13] Kicking 186.89.210.25 because they didn't logon to the game.
[14:28:50] [connection] 186.89.210.25:50990 requests connection cookie.
[14:29:21] Kicking 186.89.210.25 because they didn't logon to the game.
[14:30:25] [connection] 187.184.222.174:59283 requests connection cookie.
[14:30:44] [connection] 170.51.71.37:64110 requests connection cookie.
[14:30:45] [connection] 170.51.71.37:64110 requests connection cookie.
[14:30:56] Kicking 187.184.222.174 because they didn't logon to the game.
[14:31:55] [connection] 200.5.75.2:57652 requests connection cookie.
[14:31:58] [connection] 186.89.210.25:53980 requests connection cookie.
[14:32:26] Kicking 200.5.75.2 because they didn't logon to the game.
Thank you if you could submit some useful information!
|
I am also having the same problem!
Re: Server uses 100% CPU -
hamzajaved780 - 09.05.2015
Exactly same problem here, I thought that it had to do something with the gm but now its clear that something is wrong with the new update.
Re: Server uses 100% CPU -
Sgt.TheDarkness - 09.05.2015
I don't see how you can say this is a problem with the SA-MP update. My server uses a lot of loops and checks of various sorts (which require loops). I've never ever had an issue, the tip here is to realize that if this were an exploit, the remote attacker would have to initiate a connection to your server before this even happens.
9 times out of 10, this is your code infinite looping.