mojira.dev
MC-118372

Faulty netty-4.1.9.Final release causes players to be kicked from the server

I'm getting unix netty errors with 1.12,

Server1.log and server2.log

This is server grade hardware and this error did not show
until this morning after 1.12 patch.

Server3.log says allot for being so short, I would read it
attached.

Linked issues

Attachments

Comments

pokechu22

Netty was updated from 4.0.23 to 4.1.9 in 1.12, so it's possible that this is a new bug from that.


Internal Exception: io.netty.channel.unix.Errors$NativeIoException: syscall:read(..) failed: Connection reset by peer

I can find a few references to that message: #3539, #6266. Both were supposedly fixed, but it might be that it's still an issue that's exposed in a different way.

kjiang

(https://bugs.mojang.com/browse/MC-118733)
The same issue here, it keeps happening to me for days and several times! It is totally unacceptable for any servers like us which are supposed to provide stable and meaningful service to the public. Just take a simple look at https://bstats.org/global/bukkit you will find that over 80% of server are running on an Unix-like system. It means that those server, including some big networks, will never have a chance to upgrade to 1.12 if it is not fixed!

I believe it is very simple to fix this issue: just upgrade netty to 4.1.10 version (see https://github.com/netty/netty/issues/6607 ).
If this issue could not be fix, or at least provide some temporary solutions for people, I have no choice but to downgrade my whole network back to 1.11.2.

pokechu22

OK, let's see whether that will work. Download netty-all 4.1.11-Final, put it in the same directory as your server, and launch the server with

java -cp netty-all-4.1.11.Final.jar:minecraft_server.1.12.jar net.minecraft.server.MinecraftServer --nogui

which should force a newer version of netty (no guarantees). Does that work?

kjiang

It takes several days on testing since the issue occurs randomly (depending on how and how many player join). So I will report our results on Monday or if it breaks.

For those who need to run cb/spigot, here is the command you need:

java -server -Xmx2G -cp netty-all-4.1.11.Final.jar:spigot-1.12.jar org.bukkit.craftbukkit.Main

It has NO guarantee. I'm not working for Mojang or Spigotmc, so good luck to you! (and me lol)

kjiang

After 3 days of testing, although my server still throw this warning to me occasionally:

[21:19:09] [Netty Server IO #3/WARN]: Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@b338db7.
[21:19:09] [Netty Server IO #3/INFO]: Migrated 3 channel(s) to the new Selector.

Good news is no more player is kicked or prevented. The newer version of netty seems working again.

For the warning it self, I did some dig in about this. Founds out that it looks like that there might be something to do with incompatibility with certain version of kernel and netty. However my kernel is 4.4.0 running Ubuntu 16.04LTS which should be pretty main-stream at this moment, so more people must be affected by this (even though 4.1.11 don't kick player anymore). But what really bugs me is that this issue was first reported way before 4.0.22. Remember, we didn't have such a problem before 1.12 when Minecraft was using netty 4.0.23 by then. My guess is there should be more bugs in netty which should be fixed before it breaks things again.

I highly suggest that people who working at Mojang should not only upgrade netty to a newer version, but report the warning to the netty project team as well. Only you guys can do it because we don't have access to the minecraft code and we can not debug with it.

Thank all of you for the consideration and effort!

Steve Mekkelsen Madden

I'm getting a similar netty exception but on Windows 10 Pro x64, so it appears not to be related to the O/S itself. The first time, I left the server running for a couple hours and came back and it was refusing connections. I restarted, was able to join the game and I exited the game. Then 5 minutes later, the netty exception below occurred (no players connected) and now I cannot connect to the server again.
If it helps debug this further, I'm using:
1. Java SDK 1.8.0_144 x64
2. OptiFine for Forge 1.12.2 (optifine.OptiFineForgeTweaker from OptiFine_1.12.2_HD_U_C6.jar
3. Forge Server 1.12.2 (Forge Mod Loader version 14.23.0.2487 for Minecraft 1.12.2
4. Minecraft Client 1.12.2 (1.12.2-forge1.12.2-14.23.0.2487)

[17:24:39] [Server thread/INFO]: smmmadden left the game
[17:29:30] [Server thread/WARN]: Can't keep up! Did the system time change, or is the server overloaded? Running 2929ms behind, skipping 58 tick(s)
> Oct 05, 2017 8:13:20 PM io.netty.channel.nio.NioEventLoop select
*WARNING: Selector.select() returned prematurely 512 times in a row; rebuilding Selector *io.netty.channel.nio.SelectedSelectionKeySetSelector@19beafcb.
Oct 05, 2017 8:13:20 PM io.netty.channel.nio.NioEventLoop select
WARNING: Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@1968a7f4.
Oct 05, 2017 8:13:20 PM io.netty.channel.nio.NioEventLoop select
WARNING: Selector.select() returned prematurely 512 times in a row; rebuilding Selector io.netty.channel.nio.SelectedSelectionKeySetSelector@7da790c1.
Oct 05, 2017 8:13:20 PM io.netty.channel.nio.NioEventLoop rebuildSelector0
INFO: Migrated 0 channel(s) to the new Selector.
Oct 05, 2017 8:13:20 PM io.netty.channel.nio.NioEventLoop rebuildSelector0
INFO: Migrated 0 channel(s) to the new Selector.
Oct 05, 2017 8:13:21 PM io.netty.channel.nio.NioEventLoop rebuildSelector0
*WARNING: Failed to re-register a Channel to the new Selector.
java.lang.ClassCastException: io.netty.channel.nio.SelectedSelectionKeySetSelector cannot be cast to java.nio.channels.spi.AbstractSelector*
at java.nio.channels.spi.AbstractSelectableChannel.register(Unknown Source)
at io.netty.channel.nio.NioEventLoop.rebuildSelector0(NioEventLoop.java:347)
at io.netty.channel.nio.NioEventLoop.rebuildSelector(NioEventLoop.java:318)
at io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:769)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:388)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
at java.lang.Thread.run(Unknown Source)

pokechu22

Try updating netty as per this comment. The latest build of netty is 4.1.16-Final.

Max Rostas

I'm running a forge server, and I'm confused as to to how to modify my startup script to use the new netty version. Help?

I posted a support topic at the forge forums. I'll leave this here for any other forge users having the same issue.

pokechu22

Forge is complicated (it's got a couple of levels of launching) and I really am not qualified to provide forge support; you'd be better off asking in one of the forge help areas. Sorry I can't be helpful here.

Rektroth

When I run the command as per this comment, I get the following:
Error: Could not find or load main class net.minecraft.server.MinecraftServer
Caused by: java.lang.ClassNotFoundException: net.minecraft.server.MinecraftServer

pokechu22

That means that the Minecraft server jar wasn't on the classpath. The most likely cause is platform distinctions between : and ; as a classpath separator; on windows you use ;. (n.b. the latest release is also now 4.1.25.Final)

campoy

No User

Nathan Adams

Community Consensus

Minecraft 1.12, Minecraft 1.12.2, Minecraft 18w20c, Minecraft 18w22c, Minecraft 1.13-pre3

Minecraft 1.13-pre5

Retrieved