infinite loop? Causing high CPU usage -
KyleSta123 - 17.12.2015
G'day
Running my server, went to go in it today and it was down, logged into my host to get a message saying it has been automatically turned off due to high CPU usage... I asked them and they said
"discovered your server code has an infinite loop which is initiated as soon as the server is started. I would recommend checking any code/functions which are included OnGameModeInit and any recent plugins you added to your server."
Anyway it's originating from my streamer.pwn (I run my gamemode in separate parts)
I've been through all of it 3 times and can't see anything that would cause this.
So when the server is initiated, something in one of my gamemode parts (streamer(objects, pickups, text, etc)) does an infinite loop causing high CPU.
I highly doubt anyone will know an answer but yeah thanks
Re: infinite loop? Causing high CPU usage -
ikey07 - 17.12.2015
check all while() and for(), also run it on your localhost to see what happens.
Re: infinite loop? Causing high CPU usage -
SickAttack - 17.12.2015
Quote:
I highly doubt anyone will know an answer but yeah thanks
|
Of course, your sloppy code isn't our doings.
There won't be a precise answer without seeing the source code.
Re: infinite loop? Causing high CPU usage -
Ritzy2K - 25.12.2015
Infinite loop? Wtf.
Do you see any?
for(;; ) (had to give space it turns it into a gawd dayum smiley)
??
Re: infinite loop? Causing high CPU usage -
Mauzen - 08.01.2016
Test it on your local machine. Its possible that the streamer just takes a while to load all the objects, and the hoster stops this after a moment as it seems "infinite".
Alternatively, add a printf("some unique label", for_index); to all your loops and watch the output for a moment. Et voila! Youll see the label of the loop that does not stop.
Edit: Wow, this thread is old. Getting really silent in scripting discussion.
Re: infinite loop? Causing high CPU usage -
[eLg]elite - 12.01.2016
I would check all of my control structures. (if, else, for, while, etc...) If it's happening as soon as the server initiates it will either be in a plugin, include or under OnGameModeInit. I would check all of the includes and plugins that are being used in that .pwn aswell.
Re: infinite loop? Causing high CPU usage -
Kyle - 01.02.2016
Run the profiler plugin by JernejL - That will be able to help identify what's causing the recursive calls.
You can also add checks to stop the loop if the interations exceed X value.
Re: infinite loop? Causing high CPU usage -
Slice - 13.02.2016
Quote:
Originally Posted by KyleSmith
Run the profiler plugin by JernejL - That will be able to help identify what's causing the recursive calls.
You can also add checks to stop the loop if the interations exceed X value.
|
Profiler by Zeex?
And if it were recursive calls, he would get a stack overflow very quickly. An infinite loop is not related to recursion.