The bug
A few Minecraft servers display "Pinging..." followed by "Can't connect to server", occasionally. This appears to happen when opening the multiplayer/server list for the first time or after the minecraft client startup or when refreshed the multiplayer server lists.
Code analysis
It appears that most parts of the code analysis of MC-73207 apply again. There has been some refactoring (LazyLoadBase
uses a Supplier
now) which likely replaced the fix by accident.
The following class might be a better replacement for or addition to the LazyLoadBase
class. The only restriction is that the factory
should be thread-safe.
public class ThreadSafeLazySupplier<T> implements Supplier<T> {
private final Supplier<T> factory;
private final Object valueCreationMonitor;
private volatile boolean hasValue;
private volatile T value;
public ThreadSafeLazySupplier(final Supplier<T> factory) {
this.factory = factory;
valueCreationMonitor = new Object();
hasValue = false;
}
@Override
public T get() {
if (!hasValue) {
synchronized(valueCreationMonitor) {
if (!hasValue) {
value = factory.get();
hasValue = true;
}
}
}
return value;
}
}
Linked issues
is duplicated by
Attachments
Comments

This is happening on startup of the game and occasionally.
> Try to add 5-6 server lists on your multiplayer menu and restart your game.
> Click to multiplayer
> if all servers is dislay online (if server is online) try again.
Try it a few times.
Otherwise this error it is from me.

The same problem occasionally occurs when refresh the server list.

I changed the title and the description. Because this problem is happen when refreshed the multiplayer server lists, too.

Happens in 1.12.2

@@unknown, in 1.12.2 this bug is exist but it's relates to MC-73207 and it's fixed in 1.13 snapshots.

Confirmed for 1.13.1, see
[media]
When I tried to click "Multiplayer" the server lists they will load very very slow. @[Mojang] Nathan Adams sorry but you need to fix this bug because lots of peoples are playing on multiplayer servers.
I can confirm in 21w07a and 1.16.5.

1.17.1
Cannot reproduce.