[Oxyd] [0.14.7] Reading stdin failed

Bugs that are actually features.
Post Reply
rfvgyhn
Burner Inserter
Burner Inserter
Posts: 18
Joined: Fri Apr 22, 2016 5:14 pm
Contact:

[Oxyd] [0.14.7] Reading stdin failed

Post by rfvgyhn »

I'm not sure if this is an issue with how I'm running factorio or if it's a bug. After starting the RCON interface, I'm seeing a stdin read failure. The game still runs fine though.

Code: Select all

0.000 2016-09-16 15:48:21; Factorio 0.14.7 (build 24699, linux64, headless)
   0.000 Operating system: Linux
   0.000 Program arguments: "/opt/factorio/bin/x64/factorio" "/usr/local/bin/factorio" "--start-server" "/saves/game2.zip" "--autosave-interval" "2" "--autosave-slots" "3" "--afk-autokick-interval" "0" "--allow-commands" "false" "--mod-directory" "/mods" "--rcon-password" "[redacted]" "--rcon-port" "27015" "--server-settings" "/config/server-settings.json" 
   0.000 Read data path: /opt/factorio/data
   0.000 Write data path: /opt/factorio
   0.000 Binaries path: /opt/factorio/bin
   0.015 Running in headless mode
   0.044 Loading mod core 0.0.0 (data.lua)
   0.050 Loading mod base 0.14.7 (data.lua)
   0.312 Checksum for core: 1620335853
   0.312 Checksum for mod base: 330946690
   1.155 Info PlayerData.cpp:47: Local player-data.json unavailable
   1.155 Info PlayerData.cpp:52: Cloud player-data.json unavailable
   1.163 Custom inputs active: 0
   1.165 Factorio initialised
   1.176 Info ServerSynchronizer.cpp:27: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0).
   1.176 Info ServerMultiplayerManager.cpp:625: mapTick(-1) changing state from(Ready) to(PreparedToHostGame)
   1.176 Info ServerMultiplayerManager.cpp:625: mapTick(-1) changing state from(PreparedToHostGame) to(CreatingGame)
   1.176 Loading map /saves/game2.zip
   1.239 Info Scenario.cpp:148: Map version 0.14.7-0
   8.956 Checksum for script /opt/factorio/temp/currently-playing/control.lua: 900459546
   9.081 Info PosixUDPSocket.cpp:50: Opening socket at port 34197
   9.081 Hosting game at port 34197
   9.082 Info HttpSharedState.cpp:44: Downloading https://auth.factorio.com/generate-server-padlock
   9.425 Info HttpSharedState.cpp:108: Status code: 200
   9.425 Info AuthServerConnector.cpp:106: Obtained serverPadlock for serverHash ([redacted]) from the auth server.
   9.425 Info ServerMultiplayerManager.cpp:625: mapTick(21564001) changing state from(CreatingGame) to(InGame)
   9.426 Info RemoteCommandProcessor.cpp:97: Starting RCON interface at port 27015
   9.427 Error InterruptibleStdioStream.cpp:53: Reading stdin failed

Oxyd
Factorio Staff
Factorio Staff
Posts: 1398
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [0.14.7] Reading stdin failed

Post by Oxyd »

Did you close Factorio's stdin? How did you start Factorio – manually from shell, or using some script?

rfvgyhn
Burner Inserter
Burner Inserter
Posts: 18
Joined: Fri Apr 22, 2016 5:14 pm
Contact:

Re: [0.14.7] Reading stdin failed

Post by rfvgyhn »

Using this script

Code: Select all

#!/bin/sh

passwordPath="/config/rconpw"
if [[ ! -f $passwordPath ]]; then
    password=$(pwgen 15 1)
    echo $password > $passwordPath
else
    password=$(cat $passwordPath)
fi

mapGenSettings="/config/map-gen-settings.json"
if [[ ! -f $mapGenSettings ]]; then
    cp /tmp/map-gen-settings.json $mapGenSettings
fi

serverSettings="/config/server-settings.json"
if [[ ! -f $serverSettings ]]; then
    cp /tmp/server-settings.json $serverSettings
fi

rm /tmp/map-gen-settings.json
rm /tmp/server-settings.json

saveFile="/saves/$FACTORIO_SAVE_NAME.zip"
if [[ ! -f $saveFile ]]; then
    factorio --create $saveFile --map-gen-settings $mapGenSettings
fi

params="--start-server $saveFile"
params="$params --autosave-interval ${FACTORIO_AUTOSAVE_INTERVAL}"
params="$params --autosave-slots ${FACTORIO_AUTOSAVE_SLOTS}"
params="$params --afk-autokick-interval ${FACTORIO_AFK_AUTOKICK_INTERVAL}"
params="$params --allow-commands ${FACTORIO_ALLOW_COMMANDS}"
params="$params --mod-directory /mods"
params="$params --rcon-password $password"
params="$params --rcon-port 27015"
params="$params --server-settings $serverSettings"

if ! echo "$FACTORIO_AUTO_PAUSE" | grep -iq true; then
    params="$params --no-auto-pause"
fi

exec factorio $params
`factorio` is an executable at /usr/local/bin

Code: Select all

#!/opt/factorio/bin/x64/factorio
`$params` is

Code: Select all

--start-server /saves/meeseeks.zip --autosave-interval 2 --autosave-slots 3 --afk-autokick-interval 0 --allow-commands false --mod-directory /mods --rcon-password asdf --rcon-port 27015 --server-settings /config/server-settings.json
This is my first time working with shell scripts so it's likely something stupid that I'm doing. I started seeing this issue after the 14.7 release was removed and then added back to the downloads page.

rfvgyhn
Burner Inserter
Burner Inserter
Posts: 18
Joined: Fri Apr 22, 2016 5:14 pm
Contact:

Re: [Oxyd] [0.14.7] Reading stdin failed

Post by rfvgyhn »

Ok, so this one seems to be an issue when running via docker. When running without the interactive switch (docker run -i), I see the "Reading stdin failed" message. I'm not familiar enough with docker to know if this is a docker bug, an alpine bug, how docker is supposed to work or if InterruptibleStdioStream.cpp isn't handling some sort of edge case though. Considering the game still runs, this can probably just be closed.

As an FYI, the docker image in question is https://hub.docker.com/r/rfvgyhn/factorio/. It runs on alpine linux with glibc instead of musl libc (alpine's default).

Oxyd
Factorio Staff
Factorio Staff
Posts: 1398
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [Oxyd] [0.14.7] Reading stdin failed

Post by Oxyd »

Yes, Docker closes stdin. Since you can't read closed stdin, it should come as no surprise that reading it fails. So there's no bug.

Post Reply

Return to “Not a bug”