How to find why my prophunt server suddenly start to use 100% of a CPU core ?
0 replies, posted
Hi,
So I had a prophunt server since more than a month, that was working correctly (I think, at least no people reported problems). I had to change from a VPS to a "true" dedicated server with a better DDoS protection. That dedicated server uses an i7 4790k as CPU with 4.4GHz max turbo which should be more that enough to run multiple gmod servers from it.
Because of that, I also wanted to had more slots, from the original 24 I used before, I increased to 38, but there is a problem : People dying on spawn. To fix that I made a small piece of code like that :
[code]function GM:IsSpawnpointSuitable( pl, spawnpointent, bMakeSuitable )
-- Les hunters sont en no collide entre eux, et les props peuvent s'échapper d'un hunter
if ( pl:Team() == TEAM_SPECTATOR or pl:Team() == TEAM_UNASSIGNED or pl:Team() == TEAM_HUNTERS) then return true end
local Pos = spawnpointent:GetPos()
-- Note that we're searching the default hull size here for a player in the way of our spawning.
-- This seems pretty rough, seeing as our player's hull could be different.. but it should do the job
-- (HL2DM kills everything within a 128 unit radius)
local Ents = ents.FindInBox( Pos + Vector( -16, -16, 0 ), Pos + Vector( 16, 16, 64 ) )
for k, v in pairs( Ents ) do
if ( IsValid( v ) && v:GetClass() == "player" && v:Alive() ) then
if v:Team() == TEAM_PROPS then
return false
end
end
end
return true
end[/code]
It allow hunters to spawn on the same spawn point (They are in no collide), props can spawn on hunters (Props are in no collide with hunters, and if a prop is AFK the hunter can kill it anyways) but props should'nt spawn if there is already a prop on the spawn point.
That seams to work (Two Hunters sometimes spawn at the same points without dying, sometimes a prop spawns on a hunter and props are not spawning on the same place) so I think my code is correct ?
However since that, I've had people complaining twice that it was very laggy and when looking at the dedicated server with htop I saw that a core of the CPU was at 100% usage when it hapenned which shouldn't be the case especialy with quite low player count (Less than 20 people connected).
Both time it hapenned on the map ph_office but I don't know if it's related, also people said me that this map was working correctly before. The first time I forced an other map and the problem stoped, the other time I didn't have the time to do something, it stopped itself when staying on the same map after sometimes.
Now the question :
Can that piece of code make this bug ? Can this be caused by a player (Like a player sending invalid data or something?) ? How can I actualy know what is using 100% of CPU ? I have very few addons and I don't think they are the problem (I'm using them on other gamemodes without any problems, even at 40 players CPU is at ~ 50%)
Is there a way to get logs of lua errors to check if there is some ? I have ULX logs but lua errors are not logged in them...
The command that start my server is this :
[code]screen -A -m -d -S prophunt /home/steam/prop_hunt/srcds_run -console -game garrysmod +maxplayers 40 +map ph_motel_blacke_v3 +gamemode prop_hunt +sv_setsteamaccount IHaveMyUniqueKeyHere +port 27025 +clientport 27006 +tvport 27021[/code]
Can I add something to get logs in there ? Or edit ULX settings to get LUA errors logged ?
PS : I attached to the console and when it was lagging I didn't see any error spam or anything at all...
Thanks for you ideas.
Arnold0.
Sorry, you need to Log In to post a reply to this thread.