Updated Upstream (BungeeCord), drop macOS natives, default native cipher off - #874
Merged
Conversation
Upstream has released updates that appear to apply and compile correctly. Two temporary patches were dropped as upstream has taken them verbatim: "Use proxy online mode state" (upstream #3998) and "Temp fixup: 26.2 team packet". This update has not been tested by PaperMC and as with ANY update, please do your own testing BungeeCord Changes: 267f1ef2 #4015: Bump io.netty:netty-bom from 4.2.16.Final to 4.2.17.Final 76111147 #4014: Bump org.junit.jupiter:junit-jupiter from 6.1.2 to 6.1.3 b5ddebd5 #4010: Drop packets of different phases that are not transition acknowledgements df0f3db3 #4012: Bump com.mysql:mysql-connector-j from 9.7.0 to 26.7.0 2e729325 #4008: Bump it.unimi.dsi:fastutil-core from 8.5.18 to 8.5.19 a65ee854 #4007: Bump org.apache.maven.plugins:maven-jar-plugin from 3.5.0 to 3.5.1 662925a1 #4006: Bump org.junit.jupiter:junit-jupiter from 6.1.1 to 6.1.2 793fbb9c #4004: Bump io.netty:netty-bom from 4.2.15.Final to 4.2.16.Final edb28b4a #4003: Bump org.jline:jline from 4.2.1 to 4.3.1 87084ae7 #4002: Bump org.junit.jupiter:junit-jupiter from 6.1.0 to 6.1.1 01cec650 #4000: Bump actions/checkout from 6 to 7 0874f09f #3996: Bump org.sonatype.central:central-publishing-maven-plugin 04a99694 #3999: Bump org.jline:jline from 4.1.3 to 4.2.1 f56d37f4 Revert back to Cloudflare zlib not zlib_ng dc538cb2 #3998: Use pending connection online mode state for login packet 0b2812d2 Fix Minecraft 26.2 scoreboard team packet
The FFM terminal provider in jline 4.3.1 and earlier has a bug that causes crashes; 4.4.0 contains the fix, replacing the temporary backbump to 4.0.9. jline-terminal-ffm/jni are deps we add ourselves, so the version is set where they are introduced, in the TerminalConsoleAppender console patch. Upstream's own jline dep lives in the log module, which that same patch comments out of the reactor, so it needs no patch of its own.
Removes the "OSX native zlib and crypto" patch and replaces it with one that makes the native cipher opt-in. Dropping the macOS patch reverts isSupportedPlatformAndArch() to upstream's Linux-only check, so macOS uses pure Java for both cipher and compression, and removes the two vendored osx-*.so binaries (~98Ki) along with the macOS branches in compile-native-arm.sh. The native cipher is then defaulted off everywhere. The mbedtls implementation is slower than the JDK's on every platform and every supported JDK -- measured 2026-08-31, AES-128-CFB8, 16 MiB, median of 3, across JDK 17/21/25: Platform mbedtls native JDK JavaCipher native vs JDK macOS arm64 4.2 MiB/s 69.5 0.06x Linux aarch64 7.2 MiB/s ~63 0.11x Linux x86_64 29.4 MiB/s ~41 0.71x AESCE/AESNI are compiled in and dispatching; the cost is that mbedtls's CFB8 driver calls mbedtls_aes_crypt_ecb once per byte. The native cipher dates to 2013 (BungeeCord c70006a) when it beat Java 7 -- the JDK baseline moved on and the comparison was never re-run. Native compression is untouched and still enabled: it remains genuinely ahead of java.util.zip (1.2-1.4x). The cipher default is still overridable with -Dnet.md_5.bungee.jni.native-cipher.enable=true. NativeCode's existing constructors continue to default to enabled, so only the EncryptionUtil call site opts out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates the BungeeCord submodule by 16 commits, and takes the opportunity to clean up
two things the update surfaced: the jline pin, and the native cipher.
Upstream changes
Mostly dependabot bumps, plus three substantive commits:
f56d37f4Revert back to Cloudflare zlib not zlib_ngdc538cb2#3998: Use pending connection online mode state for login packet0b2812d2Fix Minecraft 26.2 scoreboard team packetPatches dropped
Two of our temporary patches are gone — upstream took both verbatim, with only our
explanatory comments differing:
Use proxy online mode state→ upstream #3998Temp fixup: 26.2 team packet→ upstream0b2812d2macOS natives removed
OSX native zlib and cryptois dropped rather than updated.Upstream's zlib-ng revert left the prebuilt
osx-native-compress-arm.sowe vendoredlinked against an implementation upstream no longer uses. Rather than rebuild it, the
whole patch goes:
isSupportedPlatformAndArch()returns to upstream's Linux-only check,so macOS uses pure Java for both cipher and compression. That also removes ~98Ki of
vendored binaries and the macOS branches in
compile-native-arm.sh.For the cipher this costs nothing — see below, the native cipher was a pessimisation on
macOS by a factor of ~16. For compression, macOS loses a genuine 1.2–1.4x, which is the
actual trade being made here.
Native cipher now opt-in
The mbedtls native cipher is slower than the JDK's own implementation on every platform
and every supported JDK. Measured 2026-08-31, AES-128-CFB8, 16 MiB, median of 3, across
JDK 17/21/25:
AESCE/AESNI are compiled in and dispatching; the cost is that mbedtls's CFB8 driver calls
mbedtls_aes_crypt_ecbonce per byte. The native cipher dates to 2013 (BungeeCordc70006a3) when it beat Java 7 — the JDK baseline moved on and the comparison was neverre-run.
Those figures are single-call throughput on a large buffer, so they say nothing on their
own about packet-sized work. Re-measured across realistic sizes on Linux x86_64 (JDK 21,
median of 5 after 3 warmup rounds, 128 MiB per round, direct pooled buffers as in the
real pipeline) the ratio is flat:
Per-call overhead never gets a look in: at ~31 MiB/s a 256-byte packet takes roughly 8 µs,
against a JNI transition of tens of nanoseconds.
NativeCipheris zero-copy viamemoryAddress()andJavaCiphercopies through heap arrays, and even so the differenceis under 1% of the work at the smallest realistic packet. The per-byte
mbedtls_aes_crypt_ecbcall dominates at every size.
Only the default changes.
-Dnet.md_5.bungee.jni.native-cipher.enable=truerestores it.NativeCodegains adefaultEnabledparameter used as theSystem.getPropertyfallback;its existing constructors still default to enabled, so
EncryptionUtilis the only siteopting out.
Native compression is untouched and still enabled — it remains genuinely ahead of
java.util.zip.jline 4.4.0
The
Temp backbump jline to 4.0.9patch existed because the FFM terminal provider crasheson 4.1.x–4.3.1. 4.4.0 contains the fix, so the backbump is replaced by setting
jline-terminal-ffm/jline-terminal-jnito 4.4.0 where we introduce them, in theTerminalConsoleAppender console patch.
Upstream's own
org.jline:jlinedep lives in thelogmodule, which that same patchcomments out of the reactor — so it needs no patch at all, and we now carry no divergence
from upstream's jline version.
Testing
mvn clean packageon JDK 21: BUILD SUCCESS, all tests pass, includingNativeCipherTest(which builds its own
NativeCodeand still sees the native cipher load, confirming thedefault only moved at the
EncryptionUtilcall site) and the native zlib tests coveringupstream's zlib revert.
Cipher defaults verified against the built jar rather than just the unit tests:
JavaCipherNativeZlibnative-cipher.enable=trueNativeCipherNativeZlibnative-cipher.enable=falseJavaCipherNativeZlibNote that JDK 25 cannot build this — its
javacrejectsmaven.compiler.release=17.