mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
01a13871de
Patch documentation to come Issues with the old system that are fixed now: - World generation does not scale with cpu cores effectively. - Relies on the main thread for scheduling and maintaining chunk state, dropping chunk load/generate rates at lower tps. - Unreliable prioritisation of chunk gen/load calls that block the main thread. - Shutdown logic is utterly unreliable, as it has to wait for all chunks to unload - is it guaranteed that the chunk system is in a state on shutdown that it can reliably do this? Watchdog shutdown also typically failed due to thread checks, which is now resolved. - Saving of data is not unified (i.e can save chunk data without saving entity data, poses problems for desync if shutdown is really abnormal. - Entities are not loaded with chunks. This caused quite a bit of headache for Chunk#getEntities API, but now the new chunk system loads entities with chunks so that they are ready whenever the chunk loads in. Effectively brings the behavior back to 1.16 era, but still storing entities in their own separate regionfiles. The above list is not complete. The patch documentation will complete it. New chunk system hard relies on starlight and dataconverter, and most importantly the new concurrent utilities in ConcurrentUtil. Some of the old async chunk i/o interface (i.e the old file io thread reroutes _some_ calls to the new file io thread) is kept for plugin compat reasons. It will be removed in the next major version of minecraft. The old legacy chunk system patches have been moved to the removed folder in case we need them again.
73 lines
4.0 KiB
Diff
73 lines
4.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
Date: Sun, 15 Oct 2017 00:29:07 +0100
|
|
Subject: [PATCH] revert serverside behavior of keepalives
|
|
|
|
This patch intends to bump up the time that a client has to reply to the
|
|
server back to 30 seconds as per pre 1.12.2, which allowed clients
|
|
more than enough time to reply potentially allowing them to be less
|
|
tempermental due to lag spikes on the network thread, e.g. that caused
|
|
by plugins that are interacting with netty.
|
|
|
|
We also add a system property to allow people to tweak how long the server
|
|
will wait for a reply. There is a compromise here between lower and higher
|
|
values, lower values will mean that dead connections can be closed sooner,
|
|
whereas higher values will make this less sensitive to issues such as spikes
|
|
from networking or during connections flood of chunk packets on slower clients,
|
|
at the cost of dead connections being kept open for longer.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index c4f1ded84ec1ed152faeb835a3f50b7e31356655..e40eeb5e04d96fb55283ded82cea0a5539a2fad5 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -256,7 +256,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
public ServerPlayer player;
|
|
private int tickCount;
|
|
private int ackBlockChangesUpTo = -1;
|
|
- private long keepAliveTime;
|
|
+ private long keepAliveTime = Util.getMillis();
|
|
private boolean keepAlivePending;
|
|
private long keepAliveChallenge;
|
|
// CraftBukkit start - multithreaded fields
|
|
@@ -293,6 +293,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
private final SignedMessageChain.Decoder signedMessageDecoder;
|
|
private final LastSeenMessagesValidator lastSeenMessagesValidator;
|
|
private final FutureChain chatMessageChain;
|
|
+ private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
|
|
|
|
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
|
|
this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH);
|
|
@@ -391,18 +392,25 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
}
|
|
|
|
this.server.getProfiler().push("keepAlive");
|
|
- long i = Util.getMillis();
|
|
+ // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings
|
|
+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2
|
|
+ long currentTime = Util.getMillis();
|
|
+ long elapsedTime = currentTime - this.keepAliveTime;
|
|
|
|
- if (i - this.keepAliveTime >= 25000L) { // CraftBukkit
|
|
- if (this.keepAlivePending) {
|
|
- this.disconnect(Component.translatable("disconnect.timeout"));
|
|
- } else {
|
|
+ if (this.keepAlivePending) {
|
|
+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
|
|
+ ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
|
|
+ this.disconnect(Component.translatable("disconnect.timeout", new Object[0]));
|
|
+ }
|
|
+ } else {
|
|
+ if (elapsedTime >= 15000L) { // 15 seconds
|
|
this.keepAlivePending = true;
|
|
- this.keepAliveTime = i;
|
|
- this.keepAliveChallenge = i;
|
|
+ this.keepAliveTime = currentTime;
|
|
+ this.keepAliveChallenge = currentTime;
|
|
this.send(new ClientboundKeepAlivePacket(this.keepAliveChallenge));
|
|
}
|
|
}
|
|
+ // Paper end
|
|
|
|
this.server.getProfiler().pop();
|
|
// CraftBukkit start
|