mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-05 14:42:22 -07:00
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.
This commit is contained in:
@@ -1,6 +1,29 @@
|
||||
--- a/net/minecraft/Util.java
|
||||
+++ b/net/minecraft/Util.java
|
||||
@@ -136,7 +136,7 @@
|
||||
@@ -95,6 +95,22 @@
|
||||
private static final TracingExecutor BACKGROUND_EXECUTOR = makeExecutor("Main");
|
||||
private static final TracingExecutor IO_POOL = makeIoExecutor("IO-Worker-", false);
|
||||
private static final TracingExecutor 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);
|
||||
public static final int LINEAR_LOOKUP_THRESHOLD = 8;
|
||||
private static final Set<String> ALLOWED_UNTRUSTED_LINK_PROTOCOLS = Set.of("http", "https");
|
||||
@@ -136,7 +152,7 @@
|
||||
}
|
||||
|
||||
public static long getNanos() {
|
||||
@@ -9,7 +32,7 @@
|
||||
}
|
||||
|
||||
public static long getEpochMillis() {
|
||||
@@ -537,7 +537,7 @@
|
||||
@@ -537,7 +553,7 @@
|
||||
public static <K extends Enum<K>, V> EnumMap<K, V> makeEnumMap(Class<K> enumClass, Function<K, V> mapper) {
|
||||
EnumMap<K, V> enumMap = new EnumMap<>(enumClass);
|
||||
|
||||
|
Reference in New Issue
Block a user