Page 1 of 1

[Rseding91] [0.16.51] Segmentation fault when running out of disk space

Posted: Sun Jun 24, 2018 9:08 am
by afdw
Factorio version: 0.16.51 Demo
I was playing the Factorio demo version and downloading a big file on the same time. I have run out of space on the disk, downloading of the file has stopped. But then an autosave has happened in Factorio and the game has crashed.
Steps to reproduce:
  1. Create a small (1.5 GB) temporary filesystem:

    Code: Select all

    mkdir ram
    sudo mount -t tmpfs -o size=1536m,user,exec tmpfs ram
    
  2. Download and unpack Factorio:

    Code: Select all

    cd ram
    wget -O factorio_demo_x64_0.16.51.tar.xz https://www.factorio.com/get-download/0.16.51/demo/linux64
    tar -xf factorio_demo_x64_0.16.51.tar.xz
    
  3. Start the game:

    Code: Select all

    cd factorio/bin/x64
    ./factorio
    
  4. Set the autosave interval to 1 minute (optional)
  5. Start the campaign
  6. Create a big file on the disk:

    Code: Select all

    cd ram
    dd if=/dev/zero of=f status=progress
    

    Code: Select all

    196220416 bytes (196 MB, 187 MiB) copied, 1 s, 196 MB/s
    dd: writing to 'f': No space left on device
    709849+0 records in
    709848+0 records out
    363442176 bytes (363 MB, 347 MiB) copied, 1.9422 s, 187 MB/s
    
  7. Wait until 2 autosaves happen
Actual behaviour: the crashed with segmentation fault. It can't even finish writing the log, so I attached the log from the terminal window. On the next startup you can not load the save, last few minutes are lost: Image
This happens always to me.
Excepted behaviour: the game pauses and lets you free up some space, or at least does not crash. It can also warn when the disk space is low, like IntelliJ does: Image

Re: [Rseding91] [0.16.51] Segmentation fault when running out of disk space

Posted: Sun Jun 24, 2018 2:34 pm
by kitcat
I think the saves are unrelated. If you symlink the temp directory to a filesystem with space left and then start the campaign four times, Factorio will crash even without attempting to save the game. I think the problem is that it doesn’t handle not being able to write it’s log file. After starting the campaign three times, my factorio-current.log was at 3832 bytes. After the fourth, it was at 4096 bytes (filesystem block size), the filesystem was full and Factorio went into a “terminate called recursively” loop and hung until I killed it.

Cropped terminal output attached.

I guess it’s usually not a problem because Factorio will complain about not enough space left when it starts, but things get weird if there’s enough space on startup and the filesystem fills up while the game is running.

FYI, if I move the “saves” directory to a full filesystem and attempt to save a game, Factorio complains about not being able to save and doesn’t crash, as expected. Applies to multiple autosaves as well.

Re: [Rseding91] [0.16.51] Segmentation fault when running out of disk space

Posted: Sun Jun 24, 2018 3:22 pm
by Rseding91
Thanks for the report. It should be fixed for 0.17.