-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
snis_server using 100% cpu moving NPC ships #287
Comments
A bit better backtrace (compiled with -g):
However, then I "continued", and now cannot break into the program again. I notice space_partition_process is getting called recursively, which is a bit odd, leading to, at best, O(n^2) behavior. |
By "kill -2 pid-of-snis_server" a few times, I was able to break in with gdb again. |
I noticed:
So objects are maxed out. Not sure if that's relevant. Noticed this in the snis_server log a few times:
Might be related to hitting MAXGAMEOBJS limit. |
FWIW, the condition of snis_server consuming large amounts of CPU after a long time running can be cleared by issuing "clear all" or "regenerate" commands on the console. I suspect the issue is due to, over time, generating large amounts of persistent objects. Captured a graph of network stats... Notice at the beginning, bytes/sec sent by server is 426k, and latency is 140ms. Then both drop to near zero (after doing "clear all") then resume more "normal" levels (after "regenerate"). So, if you just let snis_server run, it seems to accumulate a lot of objects, which generate a lot of network traffic. |
If you run with autowrangling turned on in snis_multiverse, then the problem is much more serious, as multiple snis_servers will begin consuming 100% CPU, and soon the entire system becomes completely unresponsive. |
Hmm, it seems when running autowrangling, snis_server runs into problems that bind() on the socket listening for incoming connections always gets 'Address already in use' and a bunch of them get stuck trying to create the listener thread in a tight loop. |
Huh, they all seem to trying only 2 ports, 49950 and 49951. If I change this line:
to this:
The problem goes away. Something weird must happen when calling snis_randn(INT_MAX); On testing it, it either returns 0 or 65535. snis_randn() is only meant for ints up to SNIS_RAND_MAX, which is 32767. So, now I need to audit all uses of snis_randn() to make sure they're all kosher. Or, improve snis_randn(). |
The bug in the port choosing code was introduced in commit 0461667 |
This should fix the port number problem with autowrangling. I believe this is unrelated to the CPU consumption problem this bug originally mentions. |
Caught snis_server using 100% cpu...
Not clear what's going on.
The text was updated successfully, but these errors were encountered: