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

Communication errors causing premature shutdown #123

Open
mbainter opened this issue Apr 16, 2020 · 5 comments
Open

Communication errors causing premature shutdown #123

mbainter opened this issue Apr 16, 2020 · 5 comments

Comments

@mbainter
Copy link

Lately we've been seeing some odd behavior. I'm not certain but I think it's tied to these two errors that I see popping up in the server log:

Exception pinging Minecraft: end of file reached

 2020 Apr 15 (13:24:29 PDT)
app/workers/autoshutdown_minecraft_worker.rb:55:in `perform'

Could not query Minecraft: [#<Error:0x00000000053300e0 @data=#<EOFError: end of file reached>, @msg="Exception pinging Minecraft: end of file reached">, #<Error:0x0000000005343118 @data=#<Errno::ECONNREFUSED: Connection refused>, @msg="Exception querying Minecraft: Connection refused">]

Exception pinging Minecraft: Unable to read: timeout

2020 Apr 15 (13:23:26 PDT)
app/workers/autoshutdown_minecraft_worker.rb:55:in `perform'

Could not query Minecraft: [#<Error:0x0000000002cef598 @data=#<NonblockIOTimeout: Unable to read: timeout>, @msg="Exception pinging Minecraft: Unable to read: timeout">, #<Error:0x0000000002d16058 @data=#<Errno::ECONNREFUSED: Connection refused>, @msg="Exception querying Minecraft: Connection refused">] 

With automatic shutdown enabled, when this happens, it appears to assume that the server isn't in use, shuts it down and starts a snapshot process.

@Raekye
Copy link
Member

Raekye commented Apr 16, 2020

Hmmm yeah that is possibly odd. I recently added support for the Server List Ping protocol, which I believe all (Java edition) servers should support since 1.7. Gamocosm now tries to use that first instead to get the player count. However, if that fails, it still tries to use the old query protocol, so in that sense, it should be fine

However, I also modified the old query protocol to use nonblocking IO instead of ruby's Timeout (see here for an explanation why Timeout is dangerous. However, the message "Connection refused" is unrelated to a connection timing out AFAIK

Lastly, I believe the autoshutdown worker should not stop the server if it fails to ping/query. A quick glance at the code it seems that should be the case

How many times do you see these logs per start/stop of a server?

@mbainter
Copy link
Author

Well - I just see them adjacent in the log, but that doesn't mean there's a causal connection necessarily. I'll spin it up tomorrow and let it time out and see if I can get a clearer picture of what's happening.

@Raekye
Copy link
Member

Raekye commented Apr 17, 2020

Ok looking over the code this morning, it seems autoshutdown_minecraft_worker.rb was quite buggy. In fact, with one of the issues, I'm actually not sure if/how it ever worked before

Anyways, two logical bugs have been fixed (hope I got it right now). Thanks for reporting this, and please let me know if you continue to have issues

@Raekye
Copy link
Member

Raekye commented Apr 25, 2020

Ok, the old code didn't work the way it was probably intended to, but I see how it used to (coincidentally) work. There was still one super edge case bug, but I'm not sure if I actually fixed anything else

@mbainter
Copy link
Author

Since things are more solid now I'm going to try to turn autoshutdown back on this week. I'll report back soon on whether I see any further issues.

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

2 participants