2022-09-04 Minecraft java edition has issues with IPv6 and CPU
Our child plays minecraft regularly. The start was with the Microsoft minecraft edition but recently the java edition became available too without paying again. I have set up the bedrock server for the Microsoft minecraft edition to make it possible to play with other people outside the house. So the most recent request was to do this for the java edition too. I don't know much about minecraft but I can do enough with just some websearching and finding a howto. So I started with How to Set Up a Dedicated Minecraft Server on Linux which seems to be a way to try to sell dedicated servers but I have enough server hardware here at home so I just used the same virtual machine which ran the minecraft bedrock server. It turned out the default-jdk resulted in openjdk-11 getting installed and this resulted in not being able to run the latest minecraft java server. I switched to openjdk-17-jre-headless because I only need the runtime and I never want to run the graphical stuff, so that saved a lot in needed libraries and other overhead. The server started fine, but the minecraft java edition couldn't connect to it when trying to connect by name, but gave no usable error message. That's a different rant. I checked on the server side and saw the listening socket in dual-stack mode. With tcpdump I soon found out the minecraft java edition starts with the IPv4 address and gives up when that fails. The solution was to remove the IPv4 address (A record) from the name, flush the dns cache and after that it worked. This does mean that when friends want to connect that are behind ISPs that only support legacy Internet addresses they will have a different problem. Searching found information like [MC-212438] IPv4 preferred over IPv6 - Minecraft bugs where the 'solution' seems to be that Mojang (makers of Minecraft) just ignore the problem. According to Minecraft IPv6 implementation is broken. - reddit it's partly a Java problem because the default setting in Java in the 21st century is still to prefer IPv4 over IPv6. Update: Other problems started showing up with the minecraft java server, including high cpu load when combined with kvm. This CPU load was causing higher power usage and with electricity prices on the rise I don't like leaving something running that I can see on the graphs of the electricity use. I'm getting familiair with the Mojang bugtracker already and found mention of this: [MC-183518] High CPU usage on hypervisor host possibly due to excessive syscall usage by Minecraft Server.