[2.0.49] Crash when executing commands via local RCON during tick 0
Posted: Tue May 13, 2025 2:40 am
Sending RCON commands during tick 0 causes the game to crash. I have a full repro, below. This happens on 2.0.49 running on Win11 x64, but I have also experienced it with 2.0.49 running on Linux x64 as well. Here's the crash (full factorio-current.log is attached, and I can send factorio-dump-current.dmp via email or Discord if it's helpful)
As far as I can tell these three conditions are necessary to cause the crash:
rconclient/go.mod
rconclient/go.sum
rconclient/main.go
You can start the client and leave it running. The important thing is to start the client before the game starts the RCON server, so the client can connect immediately when the server is available:
Factorio_2.0.49/config/config.ini
Factorio_2.0.49/scenarios/crasher/info.json
Factorio_2.0.49/scenarios/crasher/control.lua
The game will load, then the RCON client will connect and run the command triggering the crash.
Here is a list of the different commands I tried sending over RCON during tick 0, each one leading to a crash. The only ones I could find that don't crash are /help and /quit
Let me know if there's anything else I can help but this should repro the crash for you.
Code: Select all
29.361 Checksum for script __level__/control.lua: 2552759552
29.383 Info RemoteCommandProcessor.cpp:126: Starting RCON interface at IP ADDR:({0.0.0.0:27015})
29.383 Info RemoteCommandProcessor.cpp:245: New RCON connection from IP ADDR:({127.0.0.1:56972})
Factorio crashed. Generating symbolized stacktrace, please wait ...
...
Stack trace logging done
30.150 Error PlayerInputSource.cpp:597: Cannot deduce player for input action.
30.150 Error CrashHandler.cpp:643: Received 22
Logger::writeStacktrace skipped.
30.150 Error CrashHandler.cpp:190: Map tick at moment of crash: 0
30.181 Info CrashHandler.cpp:318: Executable CRC: 1222861164
30.181 Error Util.cpp:95: Unexpected error occurred. If you're running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio forums.
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.
33.035 Uploading log file
33.054 Error CrashHandler.cpp:270: Heap validation: success.
33.055 Creating crash dump.
33.128 CrashDump success
- game.speed is very low (achieved via a scenario that changes game.speed to 0.01 during script.on_init)
- local-rcon is enabled via the hidden settings
- alongside the game, an RCON client runs that connects immediately when RCON is available and runs a command
Steps to Reproduce:
Run RCON client
To reproduce this you need something that spams RCON connection attempts then immediately runs a game command. Here is one I wrote in Go, which I dedicate into the public domain for anybody to use freely. Put these three files into some folder like `rconclient`:rconclient/go.mod
Code: Select all
module factorio_rcon_crash_demo
go 1.23.4
require github.com/gorcon/rcon v1.4.1-0.20241116133332-ccafaeb72624
Code: Select all
github.com/gorcon/rcon v1.4.1-0.20241116133332-ccafaeb72624 h1:l23/ZiR7UFuC7CCIS5bzzr+PDc1jHShKy03E0Nfz394=
github.com/gorcon/rcon v1.4.1-0.20241116133332-ccafaeb72624/go.mod h1:M6v6sNmr/NET9YIf+2rq+cIjTBridoy62uzQ58WgC1I=
Code: Select all
package main
import (
"time"
"github.com/gorcon/rcon"
)
func spamConnect() *rcon.Conn {
for {
conn, err := rcon.Dial("localhost:27015", "hunter2", rcon.SetDialTimeout(1*time.Millisecond))
if err == nil {
return conn
}
}
}
func main() {
conn := spamConnect()
defer conn.Close()
println("Connected")
conn.Execute("/seed")
}
Code: Select all
cd rconclient
go run main.go
Setup game
First, download and extract the Windows standalone build, factorio-space-age_win_2.0.49.zip, which will give you a folder Factorio_2.0.49. In that folder we will create a few files, to setup config options and create a simple scenario that sets the game speed:Factorio_2.0.49/config/config.ini
Code: Select all
; version=12
[path]
read-data=__PATH__executable__/../../data
write-data=__PATH__executable__/../..
[other]
check-updates=false
local-rcon-socket=0.0.0.0:27015
local-rcon-password=hunter2
Code: Select all
{
"name": "crasher",
"version": "1.0.0",
"title": "Crasher Demo",
"author": "jeFFeSS",
"description": "Just need an empty scenario to make it crash",
"factorio_version": "2.0",
"dependencies": [
"base"
]
}
Code: Select all
-- if the game speed is very slow, it's possible for RCON to connect during tick 0
script.on_init(function()
game.speed = 0.01
end)
Run Game
Open a terminal in the directory Factorio_2.0.49 and run this (make sure the RCON client, above, is already running first):Code: Select all
bin\x64\factorio.exe --load-scenario crasher
Here is a list of the different commands I tried sending over RCON during tick 0, each one leading to a crash. The only ones I could find that don't crash are /help and /quit
Code: Select all
/c print('hello')
/silent-command print('hello')
/time
/version
/seed
hi