FabricMC / fabric

Essential hooks for modding with Fabric.
Apache License 2.0
2.33k stars 410 forks source link

Fabric 1.14.2 (build 155 and api 0.3.0 build 176) Initialization Crash #282

Closed 0to9 closed 5 years ago

0to9 commented 5 years ago

---- Minecraft Crash Report ---- // Would you like a cupcake?

Time: 6/26/19 1:54 PM Description: Initializing game

java.lang.NullPointerException: Initializing game at net.minecraft.class_323.(class_323.java:21) at net.minecraft.class_3682.(class_3682.java:16) at net.minecraft.class_310.method_1503(class_310.java:464) at net.minecraft.class_310.method_1514(class_310.java:395) at net.minecraft.client.main.Main.main(Main.java:154) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:170) at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:129) at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:26)

A detailed walkthrough of the error, its code path and all known details is as follows:

-- Head -- Thread: Client thread Stacktrace: at net.minecraft.class_323.(class_323.java:21) at net.minecraft.class_3682.(class_3682.java:16) at net.minecraft.class_310.method_1503(class_310.java:464)

-- Initialization -- Details: Stacktrace: at net.minecraft.class_310.method_1514(class_310.java:395) at net.minecraft.client.main.Main.main(Main.java:154) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:170) at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:129) at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:26)

-- System Details -- Details: Minecraft Version: 1.14.2 Operating System: Mac OS X (x86_64) version 10.14.5 Java Version: 1.8.0_74, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 1708296784 bytes (1629 MB) / 2013265920 bytes (1920 MB) up to 2147483648 bytes (2048 MB) JVM Flags: 7 total; -Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M Fabric Mods: carpet: Carpet Mod in Fabric 0.1 fabric: Fabric API 0.3.0+build.176 fabric-api-base: fabric-api-base 0.1.0+59147463 fabric-commands-v0: fabric-commands-v0 0.1.1+25fd0c52 fabric-containers-v0: fabric-containers-v0 0.1.2+25fd0c52 fabric-content-registries-v0: fabric-content-registries-v0 0.1.1+45e1a1c8 fabric-crash-report-info-v1: fabric-crash-report-info-v1 0.1.0+59147463 fabric-events-interaction-v0: fabric-events-interaction-v0 0.1.0+59147463 fabric-events-lifecycle-v0: fabric-events-lifecycle-v0 0.1.0+59147463 fabric-item-groups-v0: fabric-item-groups-v0 0.1.0+59147463 fabric-keybindings-v0: fabric-keybindings-v0 0.1.0+59147463 fabric-mining-levels-v0: fabric-mining-levels-v0 0.1.0+59147463 fabric-models-v0: fabric-models-v0 0.1.0+59147463 fabric-networking-blockentity-v0: fabric-networking-blockentity-v0 0.1.1+25fd0c52 fabric-networking-v0: fabric-networking-v0 0.1.2+200eb5c2 fabric-object-builders-v0: fabric-object-builders-v0 0.1.1+9fe2f882 fabric-registry-sync-v0: fabric-registry-sync-v0 0.2.1+4d26f9ba fabric-renderer-api-v1: fabric-renderer-api-v1 0.1.0+02a46d5b fabric-renderer-indigo: fabric-renderer-indigo 0.1.4+9ff0718a fabric-rendering-data-attachment-v1: fabric-rendering-data-attachment-v1 0.1.0+02a46d5b fabric-rendering-fluids-v1: fabric-rendering-fluids-v1 0.1.0+dc4c57c2 fabric-rendering-v0: fabric-rendering-v0 0.1.0+59147463 fabric-resource-loader-v0: fabric-resource-loader-v0 0.1.1+59147463 fabric-tag-extensions-v0: fabric-tag-extensions-v0 0.1.0+59147463 fabric-textures-v0: fabric-textures-v0 0.1.4+792c1c35 fabricloader: Fabric Loader 0.4.8+build.155 modmenu: Mod Menu 1.6.2-92 replaymod: Replay Mod 1.14.2-2.2.0-b2 Launched Version: 1.14.2-fabric-loader-0.4.8+build.155 LWJGL: 3.2.1 build 12 OpenGL: NO CONTEXT GL Caps: Using VBOs: Yes Is Modded: Definitely; Client brand changed to 'fabric' Type: Client (map_client.txt) Resource Packs: vanilla, file/vanilla-improvements-v1-14-2-2-1556743736.zip, file/Lithos Font Upgrade.zip, file/WrenchRP.zip, file/Carpet on Stairs RP.zip Current Language: ERROR NullPointerException: null CPU:

0to9 commented 5 years ago

I looked into this issue a bit more, and I tested by removing my mods and testing each mod individually. The issue appears to be caused by the replay mod. Fabric runs properly with all the other mods, but whenever I add in the replay mod the npe comes back.

asiekierka commented 5 years ago

Sure it's not caused by ReplayMod?

Johni0702 commented 5 years ago

This is a strange one. I've seen at least three independent reports of this crash, (all on OSX, might be important), all with the RM installed, so I'm at least somewhat confident that the RM triggers it (not so sure about whether it's at fault) though I'm unable to reproduce it myself.

The thing which has me baffled is the crash itself: The call to GLFW.glfwGetMonitors() during the constructor of MonitorTracker returns null (at least that's the only opportunity I can see for a NPE in that constructor) and MC doesn't expect that. I'm not familiar with GLFW, any hints as to when glfwGetMonitors returns null (aside from when there are no monitors, which shouldn't be the case) would be very much appriciated. AFAIK, the RM shouldn't touch any of that.

To make things more confusing, this reportedly isn't an issue when using MultiMC (which would be a second explanation as to why I haven't been able to reproduce it). @0to9, does this match with what you're seeing?

Edit: Just tried a freshly installed vanilla launcher (2.1.5410) and I'm still unable to reproduce the issue. One thing to note: for me the vanilla launcher is using LWJGL 3.2.2 build 10 whereas all three reports are using 3.1.2 build 12 (possibly OSX related). Edit 2: The LWJGL difference was probably just a recent update, the person that's currently testing builds for me has 3.2.2 as well now.

Johni0702 commented 5 years ago

Thanks to the help of one very patient tester, I was able to track this down to a single line:

thumbnail = new BufferedImage(1, 1, BufferedImage.TYPE_3BYTE_BGR);

which is executed during onInitializeClient.

It turns out that merely using BufferedImage is already enough to initialize AWT. LWJGL 3 (specifically GLFW) on OSX really doesn't like other graphic toolkits running alongside it as indicated in this question on the lwjgl tracker (though I couldn't find any source for that in any docs). And that's the reason the glfwGetMonitors() call fails shortly after in a really unhelpful way.

I've gotten rid of most (hopefully all) relevant references to AWT in the 1.14.3 version of the ReplayMod which ~should fix~fixes the issue ~(awaiting confirmation from the tester)~. So, considering this isn't an issue with fabric, I think this issue can be closed.

asiekierka commented 5 years ago

Hmm. Idea: Use a System.setProperty call to force -Djava.awt.headless=true before you use anything AWT.