When trying to overwrite an older autosave, the game fails to remove the .bak.zip that is created, giving either a non-fatal warning, or often, a fatal error, crashing the server.
Code: Select all
Warning WriteFileGuard.cpp:154: Removing /factorio/saves/_autosave47.bak.zip failed: Invalid argument
Code: Select all
Error AsyncScenarioSaver.cpp:197: Saving failed: Couldn't remove /factorio/saves/_autosave51.bak.zip: Invalid argument
There seems to be an issue with deleting these files, which is causing this warning and error. It is also strange how the game crashes because it is unable to delete the files.
I believe the underlying hardware, network, OS, and file permissions are healthy, as all the files have uid/gid 845/845 (same as server process), and I have no trouble deleting the files manually with rm, even while the game is running. I never run more than 1 factorio container at a time.
Multiple other applications run on the same CephFS system without issues. By contrast, Factorio consistently fails to delete the files.
Maybe related, CephFS is notable for having high latency for fsync calls, as it has to complete the fsync on multiple storage servers before returning. This maybe takes about 50ms on average on my system, though I imagine I could have spikes up to 1 second.
The server is running on an AMD ryzen 5600X on linux 6.6.54 in the factoriotools 2.0.9 docker container on Kubernetes, with /factorio and /factorio/saves mounted as CephFS filesystems, and /factorio/config/server-settings.json and /factorio/config/rconpw mounted as read-only tmpfs filesystems.
Logs below:
server init example
Code: Select all
0.000 2024-10-23 09:07:46; Factorio 2.0.9 (build 79509, linux64, headless, space-age)
0.008 Operating system: Linux
0.010 Program arguments: "/opt/factorio/bin/x64/factorio" "--port" "34197" "--server-settings" "/factorio/config/server-settings.json" "--server-banlist" "/factorio/config/server-banlist.json" "--rcon-port" "27015" "--server-whitelist" "/factorio/config/server-whitelist.json" "--use-server-whitelist" "--server-adminlist" "/factorio/config/server-adminlist.json" "--rcon-password" <private> "--server-id" "/factorio/config/server-id.json" "--mod-directory" "/factorio/mods" "--start-server-load-latest"
0.013 Config path: /opt/factorio/config/config.ini
0.017 Read data path: /opt/factorio/data
0.025 Write data path: /factorio [51200/51200MB]
0.028 Binaries path: /opt/factorio/bin
0.042 System info: [CPU: AMD Ryzen 5 5600X 6-Core Processor, 12 cores, RAM: 64196 MB]
0.045 Environment: DISPLAY=<unset> WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=<unset> XDG_SESSION_DESKTOP=<unset> XDG_CURRENT_DESKTOP=<unset> SDL_VIDEODRIVER=<unset> __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
0.139 Running in headless mode
0.145 Audio is disabled
0.154 Info ModManager.cpp:434: FeatureFlag expansion-shaders = true
0.159 Info ModManager.cpp:434: FeatureFlag freezing = true
0.164 Info ModManager.cpp:434: FeatureFlag quality = true
0.168 Info ModManager.cpp:434: FeatureFlag rail-bridges = true
0.174 Info ModManager.cpp:434: FeatureFlag segmented-units = true
0.177 Info ModManager.cpp:434: FeatureFlag space-travel = true
0.180 Info ModManager.cpp:434: FeatureFlag spoiling = true
0.188 Loading mod core 0.0.0 (data.lua)
0.208 Loading mod base 2.0.9 (data.lua)
0.387 Loading mod elevated-rails 2.0.9 (data.lua)
0.421 Loading mod quality 2.0.9 (data.lua)
0.444 Loading mod space-age 2.0.9 (data.lua)
0.792 Loading mod base 2.0.9 (data-updates.lua)
0.813 Loading mod quality 2.0.9 (data-updates.lua)
0.849 Loading mod space-age 2.0.9 (data-updates.lua)
0.959 Checksum for core: 2820763882
1.147 Checksum of base: 1355320214
1.154 Checksum of elevated-rails: 1891730324
1.170 Checksum of quality: 3715527832
1.201 Checksum of space-age: 440491908
1.691 Prototype list checksum: 984080119
1.844 Info PlayerData.cpp:66: Local player-data.json available, timestamp 1729674461
1.850 Info PlayerData.cpp:73: Cloud player-data.json unavailable
1.865 Factorio initialised
Code: Select all
159.173 Info AppManager.cpp:290: Saving to _autosave47 (non-blocking).
159.413 Info AsyncScenarioSaver.cpp:162: Saving process PID: 247
160.379 [247] Warning WriteFileGuard.cpp:154: Removing /factorio/saves/_autosave47.bak.zip failed: Invalid argument
160.413 Info ChildProcessAgent.cpp:61: Child 247 exited with return value 0
160.413 Info AppManager.cpp:291: Saving finished
279.339 Info AppManager.cpp:290: Saving to _autosave48 (non-blocking).
279.422 Info AsyncScenarioSaver.cpp:162: Saving process PID: 288
280.356 [288] Warning WriteFileGuard.cpp:154: Removing /factorio/saves/_autosave48.bak.zip failed: Invalid argument
280.395 Info ChildProcessAgent.cpp:61: Child 288 exited with return value 0
280.395 Info AppManager.cpp:291: Saving finished
399.339 Info AppManager.cpp:290: Saving to _autosave49 (non-blocking).
399.385 Info AsyncScenarioSaver.cpp:162: Saving process PID: 329
400.093 [329] Warning WriteFileGuard.cpp:154: Removing /factorio/saves/_autosave49.bak.zip failed: Invalid argument
400.122 Info ChildProcessAgent.cpp:61: Child 329 exited with return value 0
400.122 Info AppManager.cpp:291: Saving finished
519.339 Info AppManager.cpp:290: Saving to _autosave50 (non-blocking).
519.382 Info AsyncScenarioSaver.cpp:162: Saving process PID: 370
523.203 [370] Warning WriteFileGuard.cpp:154: Removing /factorio/saves/_autosave50.bak.zip failed: Invalid argument
523.237 Info ChildProcessAgent.cpp:61: Child 370 exited with return value 0
523.240 Info AppManager.cpp:291: Saving finished
639.339 Info AppManager.cpp:290: Saving to _autosave51 (non-blocking).
639.393 Info AsyncScenarioSaver.cpp:162: Saving process PID: 411
654.040 [411] Warning WriteFileGuard.cpp:51: Writing /factorio/saves/_autosave51.zip failed; previous version (if any) should still be available
654.056 Error AsyncScenarioSaver.cpp:197: Saving failed: Couldn't remove /factorio/saves/_autosave51.bak.zip: Invalid argument
654.073 Error AsyncScenarioSaver.cpp:197: Saving failed: Couldn't remove /factorio/saves/_autosave51.bak.zip: Invalid argument
654.089 Error AsyncScenarioSaver.cpp:197: Saving failed: Couldn't remove /factorio/saves/_autosave51.bak.zip: Invalid argument
654.106 Error AsyncScenarioSaver.cpp:197: Saving failed: Couldn't remove /factorio/saves/_autosave51.bak.zip: Invalid argument
654.115 Info ChildProcessAgent.cpp:61: Child 411 exited with return value 1
654.118 Error Util.cpp:81: Attempting to create notice box in headless mode. Message: 'Couldn't remove /factorio/saves/_autosave51.bak.zip: Invalid argument'
Code: Select all
410.666 Info AppManager.cpp:310: Saving to _autosave52 (blocking).
413.017 Warning WriteFileGuard.cpp:154: Removing /factorio/saves/_autosave52.bak.zip failed: Invalid argument
413.033 Info AppManagerStates.cpp:2045: Saving finished
713.033 Info AppManager.cpp:310: Saving to _autosave53 (blocking).
714.739 Warning WriteFileGuard.cpp:51: Writing /factorio/saves/_autosave53.zip failed; previous version (if any) should still be available
714.740 Error ParallelScenarioSaver.cpp:156: Saving scenario failed: Couldn't remove /factorio/saves/_autosave53.bak.zip: Invalid argument
714.750 Error Util.cpp:81: Attempting to create notice box in headless mode. Message: 'Cannot save map: Couldn't remove /factorio/saves/_autosave53.bak.zip: Invalid argument'
I will be moving the saves folder to ext4 on RADOS Block (Ceph equivalent of iSCSI) to see if this makes my server stop crashing. I will report back with results.