3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2025-01-05 12:51:06 +01:00

even even even even even more patches

Dieser Commit ist enthalten in:
Jason Penilla 2021-11-24 19:06:43 -08:00 committet von MiniDigger | Martin
Ursprung aa948d8338
Commit fdde23eecf
7 geänderte Dateien mit 30 neuen und 28 gelöschten Zeilen

Datei anzeigen

@ -10,7 +10,7 @@ schedules. Effectively, use the callback executor as a tool of
finding issues rather than hiding these issues. finding issues rather than hiding these issues.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index e8b68702d7f720ba9d2985984547d0dda9541d41..825ed5ff5ee9fe4484dc81d1b5086d96813050e1 100644 index e8b68702d7f720ba9d2985984547d0dda9541d41..db4d506852b92fc84fe052358599153fbd013d2a 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -156,17 +156,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -156,17 +156,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -26,7 +26,7 @@ index e8b68702d7f720ba9d2985984547d0dda9541d41..825ed5ff5ee9fe4484dc81d1b5086d96
+ // Paper start - revert CB changes + // Paper start - revert CB changes
+ org.spigotmc.AsyncCatcher.catchOp("Callback Executor execute"); + org.spigotmc.AsyncCatcher.catchOp("Callback Executor execute");
+ if (this.queued != null) { + if (this.queued != null) {
+ MinecraftServer.LOGGER.fatal("Failed to schedule runnable", new IllegalStateException("Already queued")); + net.minecraft.server.MinecraftServer.LOGGER.fatal("Failed to schedule runnable", new IllegalStateException("Already queued"));
+ throw new IllegalStateException("Already queued"); + throw new IllegalStateException("Already queued");
+ } + }
+ this.queued = runnable; + this.queued = runnable;

Datei anzeigen

@ -9,10 +9,10 @@ chunk through it. This should also be OK from a leak prevention/
state desync POV because the TE is getting unloaded anyways. state desync POV because the TE is getting unloaded anyways.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f8c0574137cab33d0b5efe5d532efb132dcb914a..80f59abeb0081fe4784f3c0d027e8dfce752814b 100644 index b8e7f70f4ee1b28635537e04f7bd0d0cd6afb4b3..82ae5094025c7d86ba6fdbf4334b2575e7b6afa1 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1292,9 +1292,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1272,9 +1272,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot Start // Spigot Start
for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) { for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) {
if (tileentity instanceof net.minecraft.world.Container) { if (tileentity instanceof net.minecraft.world.Container) {
@ -28,10 +28,10 @@ index f8c0574137cab33d0b5efe5d532efb132dcb914a..80f59abeb0081fe4784f3c0d027e8dfc
} }
// Spigot End // Spigot End
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 9b02f054493ad69c7a595374e6fd600c3d64e61e..e40587b9c13d9170ef5dd0811e96b02ecaccebb2 100644 index a6ec320bdca4a1c6e23461cd10a6f7bed681f243..67b482f6cafc55b6b262f23c2b56e4d8c6d089c2 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1562,6 +1562,18 @@ public class ServerPlayer extends Player { @@ -1559,6 +1559,18 @@ public class ServerPlayer extends Player {
this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId)); this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId));
this.doCloseContainer(); this.doCloseContainer();
} }
@ -49,12 +49,12 @@ index 9b02f054493ad69c7a595374e6fd600c3d64e61e..e40587b9c13d9170ef5dd0811e96b02e
+ // Paper end - special close for unloaded inventory + // Paper end - special close for unloaded inventory
public void doCloseContainer() { public void doCloseContainer() {
this.containerMenu.removed((Player) this); this.containerMenu.removed(this);
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index fb66da46d2b3a46fe4b8d43f99a1a60f768f5f19..ce713e1857121ca52467ad561c4fbb30ae054d87 100644 index b6f8e94df86c174569ccbc69cfd031cc08271dd3..4e6364bea8f464bef690b8cc8f25a80ee699ed5a 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -498,6 +498,11 @@ public abstract class Player extends LivingEntity { @@ -496,6 +496,11 @@ public abstract class Player extends LivingEntity {
this.containerMenu = this.inventoryMenu; this.containerMenu = this.inventoryMenu;
} }
// Paper end // Paper end

Datei anzeigen

@ -8,21 +8,20 @@ cause a recursive call which would handle the increase but then
the caller would think the chunk would be unloaded. the caller would think the chunk would be unloaded.
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 823451570e02ee75bfce1c106779a0502187fcea..d4ea81824acdc1220616b24ea0f465db97f4a343 100644 index 292a26a2e13d97e4796bfe00c4d5789f94e67cc1..be8e63fb3e5c65157ea4ed9c0e3910aaba8c3d45 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -619,8 +619,10 @@ public class ChunkHolder { @@ -400,7 +400,9 @@ public class ChunkHolder {
playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state); playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state);
} }
+ protected long updateCount; // Paper - correctly handle recursion + protected long updateCount; // Paper - correctly handle recursion
protected void updateFutures(ChunkMap chunkStorage, Executor executor) { protected void updateFutures(ChunkMap chunkStorage, Executor executor) {
io.papermc.paper.util.TickThread.ensureTickThread("Async ticket level update"); // Paper
+ long updateCount = ++this.updateCount; // Paper - correctly handle recursion + long updateCount = ++this.updateCount; // Paper - correctly handle recursion
ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel); ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel);
ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel); ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel);
boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE; boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE;
@@ -662,6 +664,12 @@ public class ChunkHolder { @@ -429,6 +431,12 @@ public class ChunkHolder {
// Run callback right away if the future was already done // Run callback right away if the future was already done
chunkStorage.callbackExecutor.run(); chunkStorage.callbackExecutor.run();
@ -34,4 +33,4 @@ index 823451570e02ee75bfce1c106779a0502187fcea..d4ea81824acdc1220616b24ea0f465db
+ // Paper end - correctly handle recursion + // Paper end - correctly handle recursion
} }
// CraftBukkit end // CraftBukkit end
CompletableFuture completablefuture;

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Separate lookup locking from state access in UserCache
Prevent lookups from stalling simple state access/write calls Prevent lookups from stalling simple state access/write calls
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index 61405c2b53e03a4b83e2c70c6e4d3739ca9676cb..66dfa8c844963091b63e1f2f85d0da6dd2cd083c 100644 index 3789441e2df9410aa1c6efe59054aaba2c738633..a157f71cf55b9e97fac56c7c55b552da86000fd5 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -62,6 +62,11 @@ public class GameProfileCache { @@ -62,6 +62,11 @@ public class GameProfileCache {
@ -94,7 +94,7 @@ index 61405c2b53e03a4b83e2c70c6e4d3739ca9676cb..66dfa8c844963091b63e1f2f85d0da6d
} }
public void setExecutor(Executor executor) { public void setExecutor(Executor executor) {
@@ -322,7 +337,9 @@ public class GameProfileCache { @@ -326,7 +341,9 @@ public class GameProfileCache {
} }
private Stream<GameProfileCache.GameProfileInfo> getTopMRUProfiles(int limit) { private Stream<GameProfileCache.GameProfileInfo> getTopMRUProfiles(int limit) {

Datei anzeigen

@ -10,11 +10,11 @@ chunk future to complete. We can simply schedule to the immediate
executor to get this effect, rather than the main mailbox. executor to get this effect, rather than the main mailbox.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index dcb5b1022eb72c50dc1df3654b0c9db7c782517c..efaab00b73f48e267a033a4ef466dcbaf2af2044 100644 index db4d506852b92fc84fe052358599153fbd013d2a..6463bd3a796661a9077837ce01822a7ca69f89e2 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1451,9 +1451,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1018,9 +1018,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
chunk.unpackTicks();
return chunk; return chunk;
}); });
- }, (runnable) -> { - }, (runnable) -> {

Datei anzeigen

@ -8,18 +8,18 @@ Sync loading the chunk at this stage would cause it to load
older data, as well as screwing our region state. older data, as well as screwing our region state.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index ba1c55c4f2486cae25ce570132d9222f6ab77d49..fe15f8fdb886674278513c5fdbf17f066c9f0b4f 100644 index 6463bd3a796661a9077837ce01822a7ca69f89e2..0a3aa9808c7308917b990b8aee3740ada23a4b24 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -341,6 +341,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -235,6 +235,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
// Paper end // Paper end
+ boolean unloadingPlayerChunk = false; // Paper - do not allow ticket level changes while unloading chunks + boolean unloadingPlayerChunk = false; // Paper - do not allow ticket level changes while unloading chunks
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) { public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
super(new File(session.getDimensionPath(world.dimension()), "region"), dataFixer, dsync); super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
this.visibleChunkMap = this.updatingChunkMap.clone(); this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -802,6 +803,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -499,6 +500,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@Nullable @Nullable
ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k) { ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k) {
@ -27,7 +27,7 @@ index ba1c55c4f2486cae25ce570132d9222f6ab77d49..fe15f8fdb886674278513c5fdbf17f06
if (k > ChunkMap.MAX_CHUNK_DISTANCE && level > ChunkMap.MAX_CHUNK_DISTANCE) { if (k > ChunkMap.MAX_CHUNK_DISTANCE && level > ChunkMap.MAX_CHUNK_DISTANCE) {
return holder; return holder;
} else { } else {
@@ -1058,6 +1060,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -658,6 +660,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (completablefuture1 != completablefuture) { if (completablefuture1 != completablefuture) {
this.scheduleUnload(pos, holder); this.scheduleUnload(pos, holder);
} else { } else {
@ -40,7 +40,7 @@ index ba1c55c4f2486cae25ce570132d9222f6ab77d49..fe15f8fdb886674278513c5fdbf17f06
// Paper start // Paper start
boolean removed; boolean removed;
if ((removed = this.pendingUnloads.remove(pos, holder)) && ichunkaccess != null) { if ((removed = this.pendingUnloads.remove(pos, holder)) && ichunkaccess != null) {
@@ -1094,6 +1102,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -693,6 +701,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z); this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z);
} }
} // Paper end } // Paper end
@ -49,13 +49,13 @@ index ba1c55c4f2486cae25ce570132d9222f6ab77d49..fe15f8fdb886674278513c5fdbf17f06
} }
}; };
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index d03ca9b30380209397aed5371686e0022bf631d5..e88cae362fa167252aaa785895e378caec6ad757 100644 index 3c95e322a2ecf4fc212e168c4aa475d2e4e7ce69..7908e35a5842beb422edfed624561caffe08e6ef 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -842,6 +842,7 @@ public class ServerChunkCache extends ChunkSource { @@ -787,6 +787,7 @@ public class ServerChunkCache extends ChunkSource {
}
public boolean runDistanceManagerUpdates() { public boolean runDistanceManagerUpdates() {
if (distanceManager.delayDistanceManagerTick) return false; // Paper - Chunk priority
+ if (this.chunkMap.unloadingPlayerChunk) { net.minecraft.server.MinecraftServer.LOGGER.fatal("Cannot tick distance manager while unloading playerchunks", new Throwable()); throw new IllegalStateException("Cannot tick distance manager while unloading playerchunks"); } // Paper + if (this.chunkMap.unloadingPlayerChunk) { net.minecraft.server.MinecraftServer.LOGGER.fatal("Cannot tick distance manager while unloading playerchunks", new Throwable()); throw new IllegalStateException("Cannot tick distance manager while unloading playerchunks"); } // Paper
boolean flag = this.distanceManager.runAllUpdates(this.chunkMap); boolean flag = this.distanceManager.runAllUpdates(this.chunkMap);
boolean flag1 = this.chunkMap.promoteChunkMap(); boolean flag1 = this.chunkMap.promoteChunkMap();

Datei anzeigen

@ -23,3 +23,6 @@ index 48812329969b7192acd948db974bb77bb546f979..5b1e0ea40dea6c7d787699ed25160c8b
initial = blockState.getCollisionShape(world, mutableBlockPos, context).collide(axis3, box.move((double)(-mutableBlockPos.getX()), (double)(-mutableBlockPos.getY()), (double)(-mutableBlockPos.getZ())), initial); initial = blockState.getCollisionShape(world, mutableBlockPos, context).collide(axis3, box.move((double)(-mutableBlockPos.getX()), (double)(-mutableBlockPos.getY()), (double)(-mutableBlockPos.getZ())), initial);
if (Math.abs(initial) < 1.0E-7D) { if (Math.abs(initial) < 1.0E-7D) {
check ChunkHolder#updateFutures async catcher