[0.17.52] CPU pegged and high lag even on menu screen

Place for things which are bugs but we have no idea how to solve them. Things related to hardware, libraries, strange setups, etc.
User avatar
linearj
Inserter
Inserter
Posts: 38
Joined: Tue Aug 07, 2018 10:50 pm
Contact:

[0.17.52] CPU pegged and high lag even on menu screen

Post by linearj »

On my Linux desktop system (12 CPU, 64G memory), 0.16 always ran fine. I was finally able to install the update yesterday, but the game is extremely laggy and pegs the CPU even on the initial menu screen. Mousing over the buttons takes almost a second for the button highlight to change to the new one. It takes 1-3 seconds after clicking a button to move onto the next screen.
Running top before starting, the system is idle and load is down below 0.1. Once I start Factorio, it pegs the CPU and stays there.
I then went back and started my 0.16 install, and it still works fine. So, it should not be that something else on the system is eating resources. 0.16 still runs fine, on 0.17 the lag makes the game unplayable and menus almost unusable.

My Linux laptop (8 CPU, 16G) works fine for both 0.16 and 0.17. On starting 0.17, the CPU is pegged until shortly after the menu screen. I don't see any lag issues and was able to play several hours yesterday.

I have attached logs from both my laptop and desktop for comparison. The "install" should be identical on both systems, as I used rsync to copy the install from the desktop to the laptop.
Attachments
factorio-laptop.log
(4.34 KiB) Downloaded 147 times
factorio-desktop.log
(3.99 KiB) Downloaded 133 times
- LinearJ

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

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by Oxyd »

Code: Select all

   0.323  [0]: 0 - {[0,0], 2560x1440, SDL_PIXELFORMAT_RGB888, 0Hz}
   0.323  [1]: 1 - {[0,1440], 2560x1440, SDL_PIXELFORMAT_RGB888, 0Hz}
   0.323  [2]: 2 - {[2560,0], 2560x1440, SDL_PIXELFORMAT_RGB888, 0Hz}
   0.323  [3]: 3 - {[2560,1440], 2560x1440, SDL_PIXELFORMAT_RGB888, 0Hz}
0Hz doesn't sound right. Does anything change if you turn VSync off in Settings → Graphics?

User avatar
linearj
Inserter
Inserter
Posts: 38
Joined: Tue Aug 07, 2018 10:50 pm
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by linearj »

Do you mean turn off "Wait for VSync" ?

If so, unfortunately, it did not. I started the game, went to settings->graphics, unchecked "Wait for VSync", clicked Confirm, Back, and then Exit. I then restarted the game. Still has the same lag. Checked the setting and verified it was indeed off.

Updated log attached.
Attachments
factorio-desktop-noWaitForVSync.log
(3.99 KiB) Downloaded 138 times
- LinearJ

User avatar
linearj
Inserter
Inserter
Posts: 38
Joined: Tue Aug 07, 2018 10:50 pm
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by linearj »

Oh, and before you ask, "lspci -v" of video cards attached.
Attachments
videocards.txt
(2.24 KiB) Downloaded 147 times
- LinearJ

User avatar
linearj
Inserter
Inserter
Posts: 38
Joined: Tue Aug 07, 2018 10:50 pm
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by linearj »

Been messing with it. Tested a hypothesis: on my laptop, CPU is pegged on startup, but shortly after it reaches menu screen, it drops down to zero. I figured, maybe something is just taking longer on the desktop.

So, started it on desktop and letting it run while watching CPU. Been running almost 15m and still sitting at around 105% CPU utilitzation for the factorio process.
- LinearJ

tehfreek
Filter Inserter
Filter Inserter
Posts: 391
Joined: Thu Mar 17, 2016 7:34 am
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by tehfreek »

Can you attach strace to the process and share some of the output?

User avatar
linearj
Inserter
Inserter
Posts: 38
Joined: Tue Aug 07, 2018 10:50 pm
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by linearj »

Below, repeating. The sched_yield line repeats several dozen times, followed by the rest.

sched_yield() = 0
getpid() = 28704
getpid() = 28704
getpid() = 28704
getpid() = 28704
getpid() = 28704
getpid() = 28704
clock_gettime(CLOCK_MONOTONIC, {tv_sec=96405, tv_nsec=348874247}) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=96405, tv_nsec=348903347}) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=96405, tv_nsec=348925664}) = 0
sched_yield() = 0
sched_yield() = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=96405, tv_nsec=348994492}) = 0
sched_yield() = 0
sched_yield() = 0
recvmsg(8, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=8, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
futex(0x7ffc49de012c, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, 0x7ffc49de00e0, 23194) = 1
futex(0x7ffc49de00e0, FUTEX_WAKE_PRIVATE, 1) = 1
- LinearJ

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

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by Oxyd »

Could you run the game under perf and send me the result files, perf.data and perf.data.tar.bz2?

Code: Select all

perf record -D20000 --call-graph dwarf path/to/factorio
perf archive perf.data
The first command will run Factorio under perf – I'd like you to let it load to the main menu and then simply close the game after a few seconds. (It will wait for 20 seconds before collecting samples, and your log indicates that your desktop can load the game in 17 seconds, so that should be about right. Idea is to collect samples from the laggy menu and not from startup. You can tweak the value of the -D flag if you feel other delay would be more apropriate.)

Second command will create an archive with object files necessary to analyse the first file on another computer. perf.data and perf.data.tar.bz2 should be around 70 MB each, depending on how long you leave the game running.

User avatar
linearj
Inserter
Inserter
Posts: 38
Joined: Tue Aug 07, 2018 10:50 pm
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by linearj »

Attached.
Attachments
perf.data.tar.bz2
(13.26 MiB) Downloaded 121 times
- LinearJ

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

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by Oxyd »

Thanks, can I also have the perf.data file?

User avatar
linearj
Inserter
Inserter
Posts: 38
Joined: Tue Aug 07, 2018 10:50 pm
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by linearj »

Ah. Didn't realize that didn't get included.
Just looking at the file, and we have a problem. There is a lot of sensitive data in that file. It seems to have included environment variables, .e.g., which I cannot publish.

I may need to try and set up a controlled environment to run this again. That will take some time, unfortunately.
- LinearJ

User avatar
linearj
Inserter
Inserter
Posts: 38
Joined: Tue Aug 07, 2018 10:50 pm
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by linearj »

Tried a Q&D way to do this, and that seems to have helped. I am concerned, however, about what I am not seeing.

Is there a way I can xfer this file more securely? E.g., something more direct to you or perhaps if you share a GPG public key I can use to encrypt it...
- LinearJ

tehfreek
Filter Inserter
Filter Inserter
Posts: 391
Joined: Thu Mar 17, 2016 7:34 am
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by tehfreek »

Upload it to Google Drive and PM a private link.

User avatar
linearj
Inserter
Inserter
Posts: 38
Joined: Tue Aug 07, 2018 10:50 pm
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by linearj »

Never done that before. Will have to google how to upload to google drive :-). Will let you know...
- LinearJ

User avatar
linearj
Inserter
Inserter
Posts: 38
Joined: Tue Aug 07, 2018 10:50 pm
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by linearj »

Uploaded to google drive and PM'ed link. My first PM in the forums; it shows in my Outbox instead of Sent Messages, so not sure if it was "sent" or not...
- LinearJ

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

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by Oxyd »

Yep, I received the files just fine, thanks. I'll see if I can figure anything out from it.

User avatar
linearj
Inserter
Inserter
Posts: 38
Joined: Tue Aug 07, 2018 10:50 pm
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by linearj »

Many thanks; I am going to delete it from GD, now.
Let me know if there is anything further I can do to help!
- LinearJ

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

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by Oxyd »

Unfortunately, I don't see anything particularly relevant in that either. You're using an NVidia card – did you change any settings of the NVidia driver? Anything NVidia-related in xorg.conf(.d), environment variables, or did you change anything inside nvidia-settings? You could also try unplugging all but one of your monitors, maybe the quad-screen setup is too much for something to handle.

Since you are the only person reporting this, I'm inclined to call this an undetermined issue with your setup, with the graphics driver high on the suspect list.

User avatar
linearj
Inserter
Inserter
Posts: 38
Joined: Tue Aug 07, 2018 10:50 pm
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by linearj »

No special settings. Specifically, no changes between runs. More explicitly:

Run Factorio 0.16. Runs fine. Plays fine.
Run Factorio 0.17.52. 100% CPU and lag.
Run Factorio 0.16. Runs fine. Plays fine.

No changes or reboots or anything between the above three steps.
Same three steps on my laptop produce playable runs each time.

Big difference appears to be how Factorio is seeing the monitors:
0.16:
0.203 Available display adapters: 1
0.203 [0]: resolution 5120x2880px at [0,0]

0.17:
0.385 Available displays: 4
0.385 [0]: 0 - {[0,0], 2560x1440, SDL_PIXELFORMAT_RGB888, 0Hz}
0.385 [1]: 1 - {[0,1440], 2560x1440, SDL_PIXELFORMAT_RGB888, 0Hz}
0.385 [2]: 2 - {[2560,0], 2560x1440, SDL_PIXELFORMAT_RGB888, 0Hz}
0.385 [3]: 3 - {[2560,1440], 2560x1440, SDL_PIXELFORMAT_RGB888, 0Hz}

So, 0.17 is querying the hardware differently. Assuming we have success reports from other multi-monitor Linux users, then it could be particular to my hw. It appears at least that Factorio is not querying the vsync refresh rate properly, as it is getting 0Hz. I am betting that this zero is causing it to spin in a loop somewhere in the code.

Unplugging monitors is painful. It takes forever to get X/nvidia to agree on where to place them again, even if I save the Xorg.conf.
- LinearJ

tehfreek
Filter Inserter
Filter Inserter
Posts: 391
Joined: Thu Mar 17, 2016 7:34 am
Contact:

Re: [0.17.52] CPU pegged and high lag even on menu screen

Post by tehfreek »

linearj wrote:
Wed Jun 26, 2019 8:11 pm
Unplugging monitors is painful. It takes forever to get X/nvidia to agree on where to place them again, even if I save the Xorg.conf.
Couldn't you use xrandr to turn them off?

Post Reply

Return to “1 / 0 magic”