MehVahdJukaar / Moonlight

GNU General Public License v3.0
53 stars 28 forks source link

[1.19.2] Crash on disconnect or reloading server #108

Open impossiblearchitect opened 1 year ago

impossiblearchitect commented 1 year ago

Apparently another entry in the running pattern of "Moonlight/JAOPCA compat": I'm getting a ConcurrentModificationException that shows up when a user attempts to disconnect, or the /reload command is run. Crash report:

---- Minecraft Crash Report ----
// Why did you do that?

Time: 2023-05-21 17:23:44
Description: Rendering overlay

java.util.ConcurrentModificationException: null
    at com.google.common.collect.HashBiMap$Itr.hasNext(HashBiMap.java:443) ~[guava-31.0.1-jre.jar%23110!/:?] {}
    at java.util.Collections$UnmodifiableCollection$1.hasNext(Collections.java:1053) ~[?:?] {}
    at net.minecraft.client.resources.model.ModelBakery.<init>(ModelBakery.java:183) ~[client-1.19.2-20220805.130853-srg.jar%23923!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:A,pl:runtimedistcleaner:A}
    at net.minecraft.client.resources.model.ModelManager.m_5944_(ModelManager.java:58) ~[client-1.19.2-20220805.130853-srg.jar%23923!/:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:A,pl:runtimedistcleaner:A}
    at net.minecraft.client.resources.model.ModelManager.m_5944_(ModelManager.java:20) ~[client-1.19.2-20220805.130853-srg.jar%23923!/:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:A,pl:runtimedistcleaner:A}
    at net.minecraft.server.packs.resources.SimplePreparableReloadListener.m_10786_(SimplePreparableReloadListener.java:11) ~[client-1.19.2-20220805.130853-srg.jar%23923!/:?] {re:mixin,re:classloading,pl:mixin:APP:moonlight.mixins.json:ConditionsHackMixin,pl:mixin:APP:jaopca.mixins.json:SimplePreparableReloadListenerMixin,pl:mixin:A}
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?] {}
    at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?] {}
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {}
    at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {}
    at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {re:mixin,re:computing_frames}
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {re:mixin,re:computing_frames}
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {re:mixin}

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

-- Head --
Thread: Render thread
Stacktrace:
    at net.minecraft.client.renderer.GameRenderer.m_109093_(GameRenderer.java:888) ~[client-1.19.2-20220805.130853-srg.jar%23923!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:A,pl:runtimedistcleaner:A}
-- Overlay render details --
Details:
    Overlay name: net.minecraft.client.gui.screens.LoadingOverlay
Stacktrace:
    at net.minecraft.client.renderer.GameRenderer.m_109093_(GameRenderer.java:888) ~[client-1.19.2-20220805.130853-srg.jar%23923!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:A,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1115) ~[client-1.19.2-20220805.130853-srg.jar%23923!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:A,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:700) ~[client-1.19.2-20220805.130853-srg.jar%23923!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:A,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.m_239872_(Main.java:212) ~[client-1.19.2-20220805.130853-srg.jar%23923!/:?] {re:classloading,re:mixin,pl:runtimedistcleaner:A,pl:mixin:A,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:51) ~[client-1.19.2-20220805.130853-srg.jar%23923!/:?] {re:classloading,re:mixin,pl:runtimedistcleaner:A,pl:mixin:A,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:27) ~[fmlloader-1.19.2-43.2.11.jar%23145!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23132!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23132!/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23132!/:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23132!/:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23132!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23132!/:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23132!/:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:57) [ForgeWrapper-mmc2.jar:mmc2] {}
    at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:88) [NewLaunch.jar:?] {}
    at org.prismlauncher.EntryPoint.listen(EntryPoint.java:126) [NewLaunch.jar:?] {}
    at org.prismlauncher.EntryPoint.main(EntryPoint.java:71) [NewLaunch.jar:?] {}

Minecraft 1.19.2, Forge 43.2.11, Moonlight 2.2.33, JAOPCA 4.2.7.14

Thanks!

Dariensg commented 1 year ago

I've been able to reproduce this issue without JAOPCA. I believe I've determined the offending line as well. It is entirely within MoonlightLib within the ConditionsHackMixin. This line can cause crashing since you're looping through an iterable with hasNext and then during the loop, removing items. Removing items from an iterable while looping through the iterable cause ConcurrentModificationExceptions.

MehVahdJukaar commented 1 year ago

Are you sure it's that because that's literally what iterators are for https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Iterator.html

MehVahdJukaar commented 1 year ago

So must be something else also because I copied tha code from fabric