Repository: MinecraftForge/MinecraftForge (language: java)

Issue:
[1.21.1] JVM panic
<!-- Thank you for reporting! -->

<!-- For support with crashes and issues, please create a post on the forum instead: -->
<!-- https://www.minecraftforge.net/forum/forum/18-support-bug-reports/ -->

**Minecraft Version:** 1.21.1

**Forge Version:** 52.0.6-9 (tested)

**Logs:** 
- [jvm crashlogs](https://gist.github.com/gabizou/93822d9ed9214c24d8270cceb9424240)
- [debug log](https://gist.github.com/gabizou/18a4f697b5193472c7512ec93e55aa7f)

**Steps to Reproduce:**
 1. Install forge server on macOS 14.6.1
 2. Run forge server
 3. JVM panic crash

**Description of issue:**

I've tested on various distributions of Java 21 and I can say that I can launch minecraft server normally fine, I can run the client normally fine with the same forge versions, but running the server hard panics.


Discussion / hints:
Have you tested older versions? As this has no way to cause jline to freak out https://github.com/MinecraftForge/MinecraftForge/commit/f25287132261d7063ac2a1fd68a24e299d118b4d

The last change to touch jline was 6 months ago to add the natives so that fancy colors worked.
https://github.com/MinecraftForge/MinecraftForge/commit/7113701322f360ceb88a773332b5d0605f118ada#diff-7f825392aa37acd1cee0c2e7b9bb7366ad6eac64f3e6cdd816e156bcb69d30deR69
You can try dummying out the natives jar.
Besides that i'd try the basics, make sure to run as admin and make sure you have access to the temp dir so it can extract natives.
If you wanna do some more debugging https://github.com/jline/jline3/blob/380dab81a3905d4bb13a17277e73cd42f8b7349e/terminal-jna/src/main/java/org/jline/terminal/impl/jna/osx/OsXNativePty.java#L30 seems to be where to start.
Sounds good, I'm going to give it a shot
It seems there's some [spotty](https://github.com/jline/jline3/issues/688) support for JNA in jline3 with the Apple M architecture chips. I tried to get back to troubleshooting this after having heard of some problems with SpongeForge and ran into this when trying to run "production" vs IDE. I'd go as far as suggesting that we entirely [disable JNA for darwin](https://github.com/jline/jline3/commit/fd2589f7818d2b0ba1d88fc9011c657f92824ff8) if possible by updating jline to 3.21.0.
If bumping JLine doesn't cause issues with Forge or the game, that can be arranged.

Fix patch:
diff --git a/settings.gradle b/settings.gradle
index e6ce5b87a2e..2696071c411 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -62,7 +62,7 @@ dependencyResolutionManagement {
 
             // Terminal Console Appender.. essentually make pretty colors in the console, but it's been a PITA
             library('terminalconsoleappender', 'net.minecrell:terminalconsoleappender:1.2.0')
-            version('jline', '3.12.1')
+            version('jline', '3.25.1')
             library('jline-reader',       'org.jline', 'jline-reader'      ).versionRef('jline')
             library('jline-terminal',     'org.jline', 'jline-terminal'    ).versionRef('jline')
             library('jline-terminal-jna', 'org.jline', 'jline-terminal-jna').versionRef('jline') // Colors and tab completeion


Test patch: