Uploaded image for project: 'Minecraft Launcher'
  1. Minecraft Launcher
  2. MCL-23943

Legacy (1.6.4 and prior) servers cannot be pinged by post-1.6.4 clients

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 2.14.12 (Win 10/11)
    • None
    • None
    • OS: Windows 11
      Java: Eclipse Temurin 17.0.4
    • Unconfirmed
    •  

      The expected behaviour is that servers older than release 1.7 (i.e. 1.6.4 and older) can be seen by the multiplayer server menu in clients 1.7 and newer, but will report themselves as outdated and display their version number, as outdated servers r1.7 and newer do.

      The primary difference between 1.6.4 and older, and 1.7 and newer, is that a 1.6.4 client sends a packet with ID 0xFE to request information, which a 1.6.4 server responds to with a packet with ID 0xFF containing the server's information, whereas post-1.6.4 client and server communication is done using an entirely different method.

      Client versions 1.7 and newer (e.g. 1.20.1) are intended to support the legacy ping protocol: net.minecraft.client.multiplayer.ServerStatusPinger has a method, pingLegacyServer(InetSocketAddress, ServerData) which is used to fetch information from servers using the legacy protocol. There is a lambda method within this method, channelActive(ChannelHandlerContext), which is used to send the ping message, and another, channelRead0(ChannelHandlerContext, ByteBuf), which receives the response. channelActive() allocates a Netty ByteBuf and adds the request information to it, and attempts to send that buffer to the server. In theory, the server would then respond with the legacy format; however, the request packet is never actually sent from the client. In the "finally" branch of the try/catch block in channelActive(), the previously-allocated ByteBuf is freed using release(), which prompts a Netty IllegalReferenceCountException, terminating the channel. What this means is that the server never actually responds to the ping packet because the connection's already been closed. This means channelRead0() never runs and the client never gets to read the server's version. This method is broken, and resolving the IllegalReferenceCountException should fix the issue.

            Unassigned Unassigned
            jonkadelic jonkadelic
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: