mojira.dev
MC-237608

Server address shown when connection fails during server startup

When connecting to a server which has not yet finished its startup phase, you will get an AnnotatedConnectException from Netty. This exception contains the server ip.

This is unwanted, for example if a live streamer wants to connect to his private server and this server is in that specific startup phase, he will leak the server ip to all viewers.
This should be fixed, as a lot of live streamers want to hide the address of the server they are playing on from the public.

Structure of the message:

io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: server address here

Solution
This exception should probably be handled / catched and get its own custom error message. Additionally, it might be good to not pass any Netty exception and display it to the user.

Attachments

Comments 3

This issue was referenced by content creator xisumavoid in a tweet today, here: https://twitter.com/xisumavoid/status/1458917198836109312

Minecraft developer slicedlime replied to the tweet.

I can confirm that this is still an issue (have encountered it myself as well).

After a quick look at the decompiled code for the method net.minecraft.client.gui.screens.ConnectScreen#connect it seems like in the "generic exception case" the hostname and port are only stripped from the exception if the InetSocketAddress is not null.

The regex to filter the host/port will (probably) also not catch a string in the form of "locahost/127.0.0.1:25565"

[media]

This bug is extremely easy to replicate. Just try to connect to localhost while there isn't an open server there.
netty will give up and that general case exception will be thrown.

[media]

You could also replicate that with an server that MC can ping but its unreachable, but thats out of scope. The same exact error is thrown but the ip is censored for privacy reasons. Testing with localhost is suggested since the failure is immediate (and not whatever netty's timeout is configured to be)

[media]

 

Jakob K

slicedlime

Confirmed

Important

Networking

1.17.1

1.18 Pre-release 2

Retrieved