Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runaway cat on factorio stop #199

Closed
tmzasz opened this issue Oct 27, 2022 · 1 comment
Closed

Runaway cat on factorio stop #199

tmzasz opened this issue Oct 27, 2022 · 1 comment

Comments

@tmzasz
Copy link
Contributor

tmzasz commented Oct 27, 2022

Re creation of #185 as my repo was messy as all crap sorry.

Once you run the command factorio stop the tail -f that is attached to the server.fifo becomes a idle runaway cat attempting to read the fifo while the server is offline. This is not desirable behavior as this cat is doing nothing just reading a pipe that has stalled. as of the current commit when this issue was opened the offending line of code seems to be this line on 362 in the factorio script cat "${FIFO}" &. Removing or commenting out this line seems to prevent the rouge cat from forming on server shutdown.

here is a short video demonstrating said behaivor
https://i.gyazo.com/e95fd6690cd04011acc9930eb38e6870.mp4

Os of the machine
CentOS Linux release 7.9.2009 (Core) using kernel 4.9.178 with alt glibc root 2.18

@tmzasz
Copy link
Contributor Author

tmzasz commented Oct 27, 2022

Upon looking at the issue a bit more in depth i have to wonder what 362 is actually doing in the first place

factorio-init/factorio

Lines 361 to 368 in 8e25275

# Start the reader (in case tail stopped already)
cat "${FIFO}" &
# Open pipe for writing.
exec 3> "${FIFO}"
# Write a newline to the pipe, this triggers a SIGPIPE and causes tail to exit
echo "" >&3
# Close pipe.
exec 3>&-

as it seems to be not needed as the tail closes successfully on its own due to 364-368 and earlier on in start_service the fifo is recreated anyways

factorio-init/factorio

Lines 300 to 306 in 8e25275

# ensure we have a fifo
if ! [ -p "${FIFO}" ]; then
if ! as_user "mkfifo ${FIFO}"; then
echo "Failed to create pipe for stdin, if applicable, remove ${FIFO} and try again"
return 1
fi
fi

Bisa added a commit that referenced this issue Oct 29, 2022
@Bisa Bisa closed this as completed in f7be5f0 Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant