Need help to find a solution for high CPU
#1

Hey, I have a really big problem with my script.

Randomly, RANDOMLY, sometimes the script will get the servers CPU usage to around 95%. The server freezes, no commands work, all players stand still, etc. The only way for me to fix it is to go to the control panel of my server and restart it manually.

But..my script is around 16,000 lines long. I don't know where to put debugging, where the problem can be causing at.

Like I said, the server's cpu usage goes up randomly. We can maybe only have 5 people on, just walking, and it just crashes. So I don't know what is happening.

Thank you.
Reply
#2

Your script is probably not optimized, or you're running a loop that is not good for the server.
Reply
#3

No, my script is optimized. My CPU usage is usually always %0, %1, or %2. Never goes above that (even with like 30 players).

And what do you mean a loop that is not good for the server?
Reply
#4

Do you use any filterscripts?

I'm sure it isn't random, there must be something that's causing it. Try to test different things in-game and if it happens again, think what you did different this time and what may cause this.
Reply
#5

No, I don't use any filterscripts. It is random, it has no linear pattern, and it has happened multiple times.
Reply
#6

Can someone list some possibilities that can be causing this?
Reply
#7

Buffer overflow?
Bad optimization?
Massive loops?
Timers with very low intervals?
Reply
#8

Quote:
Originally Posted by admantis
Посмотреть сообщение
Buffer overflow?
Bad optimization?
Massive loops?
Timers with very low intervals?
I get
Quote:

sscanf warning: String buffer overflow.

in my server log. Can that be contributing to it? Plus, how do I fix that?

I only have one timer in my script which is 1 second. I have a loop with a pretty large enough of stuff in it, but not an enormous amount.
Reply
#9

Quote:
Originally Posted by lolumadd_
Посмотреть сообщение
I get in my server log. Can that be contributing to it? Plus, how do I fix that?

I only have one timer in my script which is 1 second. I have a loop with a pretty large enough of stuff in it, but not an enormous amount.
it means that the string you tried to store in the buffer is longer than the specified string.
Reply
#10

edit nvm >>

and what Darklom said, buffer overflow is when the string isnt long enough for the input
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)