Skip to content

Conversation

@itzg
Copy link
Owner

@itzg itzg commented Sep 25, 2021

Image is available for testing itzg/minecraft-server:test-auto-pause-use-mc-monitor

cc @Oekn5w @kjburr

Closes #1046


mc_server_listening() {
[[ -n $(netstat -tln | grep -e "0.0.0.0:$SERVER_PORT" -e ":::$SERVER_PORT" | grep LISTEN) ]]
mc-monitor status --host localhost --port $SERVER_PORT >& /dev/null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Propose reverting this or adding an early-fail flag in mc-monitor (used only in initial state of autopause deamon)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully understand the suggestion since that's what mc-monitor status is doing. It's used already for health checks.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...oh you mean skipping timeout?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, skipping the timeout, I couldn't get the timeout command line flag to work (--retry-interval 1s --retry-limit 1 --timeout 1s was not timing our with the stopped process). In the healthcheck the process is also checked, as the healthcheck was spawning endless processes initially.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I see what you mean and yes, this is not going to be acceptable. I'll play with tweaking the knockd config, since running mc-monitor via the debugger externally causes the knock to kick in. This also makes me realize that the mc-monitor approach is really only useful during running state to detect zero players.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo, this won't be solved by knockd, this function is only used to switch from deamon init state to the initial timeout state, so the process isn't stopped here, it's waiting for the server to listen for connections (where exactly it does that during startup is another question, especially wrt modding)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mean to imply knockd would solve this. I was just thinking out loud that I needed to temporarily change my container's config to let me recreate the blocked ping operation.

The server binds the listening port at the very end of startup, so it's a very robust (even with mods) way to know when the server is ready.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, have a PR open for the issue I found raqbit/mc-pinger#14

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, didn't know that this failure to TO was strictly related to the paused process, I was only using mc-monitor from inside the image, Checking with the pure monitor docker image to a nonexisting server, I agree with this change and understand your previous comments.

@itzg
Copy link
Owner Author

itzg commented Sep 26, 2021

@Oekn5w did you notice problems during testing? It all seemed to work fine for me, but I might have missed something since I'm not used to using the feature.

@Oekn5w
Copy link
Contributor

Oekn5w commented Sep 26, 2021

Pausing and unpausing works fine for Java clients, cannot test for Geyser

itzg and others added 2 commits September 26, 2021 11:18
Copy link
Contributor

@Oekn5w Oekn5w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the initial up detection is still open imo

@itzg
Copy link
Owner Author

itzg commented Sep 26, 2021

the initial up detection is still open imo

I'm open to more data on why it's not sufficient. If this is flawed, then the whole container readiness approach is flawed.

@itzg
Copy link
Owner Author

itzg commented Sep 30, 2021

mc-monitor 0.10.1 now properly times out when contacting a paused server

@Oekn5w
Copy link
Contributor

Oekn5w commented Sep 30, 2021

@kjburr can you test this image with Geyser and bedrock clients?

@kjburr
Copy link

kjburr commented Sep 30, 2021

Works well. The only issue I found is If a bedrock client is left open at the main menu or inside the play menu it will knock and pause repeatedly. It was listed under LAN games though not sure if that makes a difference. Java has a refresh button for servers and bedrock does not so I'm guessing it just constantly pings.

@itzg
Copy link
Owner Author

itzg commented Sep 30, 2021

Very glad to hear @kjburr. I know the bedrock client at least does periodic multicast packets, so that would make sense to then induce a knock on the java side.

I'll get this merged soon.

@itzg itzg merged commit 3482944 into master Sep 30, 2021
@itzg itzg deleted the test/auto-pause-use-mc-monitor branch February 3, 2022 04:16
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

Successfully merging this pull request may close these issues.

Autopause with Geyser

4 participants