Waterfall/BungeeCord-Patches/0062-Set-Netty-pooled-buffer-size-to-4MB.patch
_tomcraft f188d4c751
Updated Upstream (BungeeCord) (#634)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

BungeeCord Changes:
71d12463 #3066: Put ReadTimeoutHandler after frame decoder.
ac371bb5 #3073: Release HAProxyMessage after read
2021-04-29 17:36:22 +01:00

34 lines
1.6 KiB
Diff

From 80403931ef95e1569b79c85d9b62a6485ef06ac3 Mon Sep 17 00:00:00 2001
From: Andrew Steinborn <git@steinborn.me>
Date: Sat, 24 Apr 2021 17:52:33 +0100
Subject: [PATCH] Set Netty pooled buffer size to 4MB
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCordLauncher.java b/proxy/src/main/java/net/md_5/bungee/BungeeCordLauncher.java
index e830198d..771b3725 100644
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCordLauncher.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCordLauncher.java
@@ -21,6 +21,19 @@ public class BungeeCordLauncher
Security.setProperty( "networkaddress.cache.ttl", "30" );
Security.setProperty( "networkaddress.cache.negative.ttl", "10" );
+ // Waterfall start
+ // By default, Netty allocates 16MiB arenas for the PooledByteBufAllocator. This is too much
+ // memory for Minecraft, which imposes a maximum packet size of 2MiB! We'll use 4MiB as a more
+ // sane default.
+ //
+ // Note: io.netty.allocator.pageSize << io.netty.allocator.maxOrder is the formula used to
+ // compute the chunk size. We lower maxOrder from its default of 11 to 9. (We also use a null
+ // check, so that the user is free to choose another setting if need be.)
+ if (System.getProperty("io.netty.allocator.maxOrder") == null) {
+ System.setProperty("io.netty.allocator.maxOrder", "9");
+ }
+ // Waterfall end
+
OptionParser parser = new OptionParser();
parser.allowsUnrecognizedOptions();
parser.acceptsAll( Arrays.asList( "help" ), "Show the help" );
--
2.31.1