[Twinsen] [0.13.10] Headless mode (--start-server) causes 100% cpu

This subforum contains all the issues which we already resolved.
Post Reply
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

[Twinsen] [0.13.10] Headless mode (--start-server) causes 100% cpu

Post by daniel34 »

When starting a headless server on Linux or Windows the cpu consumption goes to 100% on one core/thread and stays there.
This does already happen directly after starting the server, without any clients connected. It's staying at 100% while connecting/downloading map and playing and never goes down.
Does not happen when hosting a multiplayer game using the GUI interface on Windows.

Code: Select all

top - 03:44:34 up 12 min,  2 users,  load average: 1.00, 0.90, 0.52
Tasks:  87 total,   2 running,  85 sleeping,   0 stopped,   0 zombie
%Cpu(s): 10.9 us, 14.1 sy,  0.0 ni, 75.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   4047304 total,   234672 used,  3812632 free,     7788 buffers
KiB Swap:  2094076 total,        0 used,  2094076 free.    56040 cached Mem

   PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
   456 root      20   0  286684  91916  13328 R 100.1  2.3  11:17.69 factorio
   476 root      20   0   23520   2768   2364 R   0.3  0.1   0:00.02 top
     1 root      20   0   28640   4508   2904 S   0.0  0.1   0:01.34 systemd
     2 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kthreadd
quick links: log file | graphical issues | wiki

Megapants
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sat Jul 23, 2016 2:04 am
Contact:

Re: [0.13.10] Headless mode (--start-server) causes 100% cpu

Post by Megapants »

I'm having the same issue:
Image

In the previous release (0.13.9) it was hovering around 35% with two people connected. Updated an hour ago and it's been 99.9% since with no one connected.

It's running on a 1GB DigitalOcean VPS with Ubuntu 14.04.4 LTS. No mods installed.

Using this to start the process:

Code: Select all

/opt/factorio/bin/x64/factorio --start-server /opt/factorio/data/saves/save-name.zip --latency-ms 60 --allow-commands=false --server-settings /opt/factorio/data/server-settings.json

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.13.10] Headless mode (--start-server) causes 100% cpu

Post by Klonan »

Thanks for the reports,

I just tried loading a simple map as a server, and it was using all of the CPU it can, which i think pretty much confirms it

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.13.10] Headless mode (--start-server) causes 100% cpu

Post by Rseding91 »

I'm pretty sure this is by design but Twinsen will need to confirm.

We changed our main loop implementation from a "sleep when needed" to "busy wait when needed" because sleep in programming is not accurate enough to wake up on time.
If you want to get ahold of me I'm almost always on Discord.

Twinsen
Factorio Staff
Factorio Staff
Posts: 1330
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: [Twinsen] [0.13.10] Headless mode (--start-server) causes 100% cpu

Post by Twinsen »

This is indeed a side effect of the new main loop logic. It does not exactly busy wait, but rather tries to do updates as precise as possible without sleeping.

I'll probably need to write a different main loop for the headless mode. This is rather low priority now.

Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [Twinsen] [0.13.10] Headless mode (--start-server) causes 100% cpu

Post by Oxyd »

Fixed in 0.13.12.

Megapants
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sat Jul 23, 2016 2:04 am
Contact:

Re: [Twinsen] [0.13.10] Headless mode (--start-server) causes 100% cpu

Post by Megapants »

Great, I'll give it a try now.

Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [Twinsen] [0.13.10] Headless mode (--start-server) causes 100% cpu

Post by Oxyd »

Uh, sorry. I meant 0.13.12. The fix isn't released yet.

Megapants
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sat Jul 23, 2016 2:04 am
Contact:

Re: [Twinsen] [0.13.10] Headless mode (--start-server) causes 100% cpu

Post by Megapants »

Ah, alright. Thanks for looking into it.

Post Reply

Return to “Resolved Problems and Bugs”