The bug
net.minecraft.server.MinecraftServer.getPlayerNames() (Mojang name) is not thread-safe. This can be problematic because it implements net.minecraft.server.ServerInterface.getPlayerNames() for the DedicatedServer. That method is called from a different thread when using GS4 query, see QueryThreadGs4.
Can confirm in 1.21.11:
The underlying player collection is declared as:
If a player joins or leaves on the main server thread at the exact moment the query thread is iterating, the
ArrayListcan resize or shift mid loop, triggeringIndexOutOfBoundsExceptionand silently crashing the query thread.