mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 12:11:47 +01:00
526795bacd
* Update patches to handle vineflower decompiler * update patches again to handle inlined simple lambdas * update vf again and re-apply/rebuild patches * update patches after removal of verify-merges flag * fix compile issue * remove maven local * fix some issues * address more issues * fix collision patch * use paperweight release * more fixes * update fineflower and fix patches again * add missing comment descriptor --------- Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
77 lines
4.5 KiB
Diff
77 lines
4.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Sun, 8 Aug 2021 16:26:46 -0700
|
|
Subject: [PATCH] Do not submit profile lookups to worldgen threads
|
|
|
|
They block. On network I/O.
|
|
|
|
If enough tasks are submitted the server will eventually stall
|
|
out due to a sync load, as the worldgen threads will be
|
|
stalling on profile lookups.
|
|
|
|
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
|
|
index 9a12feebbae4a9fdfd24214c2ffa61e717d6e358..1f1422a000eb9a0fb819f26d42b3f39ed683a8da 100644
|
|
--- a/src/main/java/net/minecraft/Util.java
|
|
+++ b/src/main/java/net/minecraft/Util.java
|
|
@@ -91,6 +91,22 @@ public class Util {
|
|
private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main");
|
|
private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false);
|
|
private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true);
|
|
+ // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
|
+ public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() {
|
|
+
|
|
+ private final AtomicInteger count = new AtomicInteger();
|
|
+
|
|
+ @Override
|
|
+ public Thread newThread(Runnable run) {
|
|
+ Thread ret = new Thread(run);
|
|
+ ret.setName("Profile Lookup Executor #" + this.count.getAndIncrement());
|
|
+ ret.setUncaughtExceptionHandler((Thread thread, Throwable throwable) -> {
|
|
+ LOGGER.error("Uncaught exception in thread " + thread.getName(), throwable);
|
|
+ });
|
|
+ return ret;
|
|
+ }
|
|
+ });
|
|
+ // Paper end - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
|
private static final DateTimeFormatter FILENAME_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss", Locale.ROOT);
|
|
private static final int LINEAR_LOOKUP_THRESHOLD = 8;
|
|
public static final long NANOS_PER_MILLI = 1000000L;
|
|
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
|
index 92c22dc10e385f1942f2ec375bbce9faf257462b..adb472c175cc6f6ced7075a37423d6c898fd5ccb 100644
|
|
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
|
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
|
@@ -169,7 +169,7 @@ public class GameProfileCache {
|
|
} else {
|
|
CompletableFuture<Optional<GameProfile>> completablefuture1 = CompletableFuture.supplyAsync(() -> {
|
|
return this.get(username);
|
|
- }, Util.backgroundExecutor()).whenCompleteAsync((optional, throwable) -> {
|
|
+ }, Util.PROFILE_EXECUTOR).whenCompleteAsync((optional, throwable) -> { // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
|
this.requests.remove(username);
|
|
}, this.executor);
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
|
index bffc770105800ba78c6d9bfb56ad9ad425f19910..d0b3a836de9830a4da534bedd9f94a16a82ef9c6 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
|
@@ -80,7 +80,7 @@ public class SkullBlockEntity extends BlockEntity {
|
|
} else {
|
|
return Optional.empty();
|
|
}
|
|
- }, Util.backgroundExecutor());
|
|
+ }, Util.PROFILE_EXECUTOR); // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
|
|
index 358af0121ce3d87a9f51da2bae0699034c1560b4..edd340c66ea8cec1c76ba29f1deab14c4784a7e5 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
|
|
@@ -122,7 +122,7 @@ public final class CraftPlayerProfile implements PlayerProfile {
|
|
|
|
@Override
|
|
public CompletableFuture<PlayerProfile> update() {
|
|
- return CompletableFuture.supplyAsync(this::getUpdatedProfile, Util.backgroundExecutor());
|
|
+ return CompletableFuture.supplyAsync(this::getUpdatedProfile, Util.PROFILE_EXECUTOR); // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
|
}
|
|
|
|
private CraftPlayerProfile getUpdatedProfile() {
|