[Forge - 1.19.2 - 1.0.19]: constrainBounds endless loop
SiverDX opened this issue ยท 4 comments
EMI deadlocks the render thread when the gem working station of Apotheosis is used
Any idea as to why?
This also seems to happen (sometimes?) when opening the inventory before EMI has finished loading
(Potentially only with large modpacks or certain mods...?)
It was switching between these two and then stopped at some point:
And now it's processing the one with size 7 and i
goes up to 5
Then it reaches the part where i
gets set to -1 but after that i
gets set to 0
(Since -1 is < 7 (exclusion size) and the overlap
doesn't seem to be empty at that point)
Thread dump:
java.lang.Thread.State: RUNNABLE
at dev.emi.emi.screen.EmiScreenManager.constrainBounds([email protected]+1.19.2+forge/EmiScreenManager.java:328)
at dev.emi.emi.screen.EmiScreenManager.createScreenSpace([email protected]+1.19.2+forge/EmiScreenManager.java:286)
at dev.emi.emi.screen.EmiScreenManager.recalculate([email protected]+1.19.2+forge/EmiScreenManager.java:216)
at dev.emi.emi.screen.EmiScreenManager.forceRecalculate([email protected]+1.19.2+forge/EmiScreenManager.java:227)
at dev.emi.emi.screen.EmiScreenManager.addWidgets([email protected]+1.19.2+forge/EmiScreenManager.java:777)
at net.minecraft.client.gui.screens.Screen.handler$cnd000$init([email protected]/Screen.java:3746)
at net.minecraft.client.gui.screens.Screen.m_6575_([email protected]/Screen.java:416)
at net.minecraft.client.Minecraft.m_91152_([email protected]/Minecraft.java:974)
at net.minecraft.client.gui.screens.MenuScreens$ScreenConstructor.m_96209_([email protected]/MenuScreens.java:117)
at net.minecraft.client.gui.screens.MenuScreens.lambda$create$0([email protected]/MenuScreens.java:43)
at net.minecraft.client.gui.screens.MenuScreens$$Lambda$43896/0x0000000805875b90.accept([email protected]/Unknown Source)
at java.util.Optional.ifPresent([email protected]/Unknown Source)
at net.minecraft.client.gui.screens.MenuScreens.m_96201_([email protected]/MenuScreens.java:43)
at net.minecraft.client.multiplayer.ClientPacketListener.m_5980_([email protected]/ClientPacketListener.java:987)
at net.minecraft.network.protocol.game.ClientboundOpenScreenPacket.m_5797_([email protected]/ClientboundOpenScreenPacket.java:37)
at net.minecraft.network.protocol.game.ClientboundOpenScreenPacket.m_5797_([email protected]/ClientboundOpenScreenPacket.java:11)
at net.minecraft.network.protocol.PacketUtils.m_131356_([email protected]/PacketUtils.java:22)
at net.minecraft.network.protocol.PacketUtils$$Lambda$40905/0x000000080547fc48.run([email protected]/Unknown Source)
at net.minecraft.util.thread.BlockableEventLoop.m_6367_([email protected]/BlockableEventLoop.java:157)
at net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_([email protected]/ReentrantBlockableEventLoop.java:23)
at net.minecraft.util.thread.BlockableEventLoop.m_7245_([email protected]/BlockableEventLoop.java:131)
at net.minecraft.util.thread.BlockableEventLoop.m_18699_([email protected]/BlockableEventLoop.java:116)
at net.minecraft.client.Minecraft.m_91383_([email protected]/Minecraft.java:1072)
at net.minecraft.client.Minecraft.m_91374_([email protected]/Minecraft.java:700)
at net.minecraft.client.main.Main.m_239872_([email protected]/Main.java:212)
at net.minecraft.client.main.Main.main([email protected]/Main.java:51)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0([email protected]/Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke([email protected]/Unknown Source)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke([email protected]/Unknown Source)
at java.lang.reflect.Method.invoke([email protected]/Unknown Source)
at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0([email protected]/CommonClientLaunchHandler.java:27)
at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler$$Lambda$936/0x0000000800ff0e10.run([email protected]/Unknown Source)
at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch([email protected]/LaunchServiceHandlerDecorator.java:30)
at cpw.mods.modlauncher.LaunchServiceHandler.launch([email protected]/LaunchServiceHandler.java:53)
at cpw.mods.modlauncher.LaunchServiceHandler.launch([email protected]/LaunchServiceHandler.java:71)
at cpw.mods.modlauncher.Launcher.run([email protected]/Launcher.java:106)
at cpw.mods.modlauncher.Launcher.main([email protected]/Launcher.java:77)
at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept([email protected]/BootstrapLaunchConsumer.java:26)
at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept([email protected]/BootstrapLaunchConsumer.java:23)
at cpw.mods.bootstraplauncher.BootstrapLauncher.main([email protected]/BootstrapLauncher.java:141)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0([email protected]/Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke([email protected]/Unknown Source)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke([email protected]/Unknown Source)
at java.lang.reflect.Method.invoke([email protected]/Unknown Source)
at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:57)
at java.lang.invoke.LambdaForm$DMH/0x0000000800c02400.invokeStaticInit([email protected]/LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/0x0000000800c02c00.invokeExact_MT([email protected]/LambdaForm$MH)
at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:88)
at org.prismlauncher.EntryPoint.listen(EntryPoint.java:126)
at org.prismlauncher.EntryPoint.main(EntryPoint.java:71)
java.lang.Thread.State: RUNNABLE
at dev.emi.emi.screen.EmiScreenManager.constrainBounds([email protected]+1.19.2+forge/EmiScreenManager.java:330)
at dev.emi.emi.screen.EmiScreenManager.createScreenSpace([email protected]+1.19.2+forge/EmiScreenManager.java:286)
at dev.emi.emi.screen.EmiScreenManager.recalculate([email protected]+1.19.2+forge/EmiScreenManager.java:216)
at dev.emi.emi.screen.EmiScreenManager.render([email protected]+1.19.2+forge/EmiScreenManager.java:553)
at dev.emi.emi.platform.forge.EmiClientForge.renderScreenForeground([email protected]+1.19.2+forge/EmiClientForge.java:79)
at dev.emi.emi.platform.forge.EmiClientForge$$Lambda$32629/0x0000000804ba5cd0.accept([email protected]+1.19.2+forge/Unknown Source)
at net.minecraftforge.eventbus.EventBus.doCastFilter(net.minecraftforge.eventbus/EventBus.java:260)
at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(net.minecraftforge.eventbus/EventBus.java:252)
at net.minecraftforge.eventbus.EventBus$$Lambda$1684/0x00000008013af570.invoke(net.minecraftforge.eventbus/Unknown Source)
at net.minecraftforge.eventbus.EventBus$$Lambda$4872/0x00000008019f9b98.invoke(net.minecraftforge.eventbus/Unknown Source)
at net.minecraftforge.eventbus.EventBus.post(net.minecraftforge.eventbus/EventBus.java:315)
at net.minecraftforge.eventbus.EventBus.post(net.minecraftforge.eventbus/EventBus.java:296)
at net.minecraft.client.gui.screens.inventory.AbstractContainerScreen.m_6305_([email protected]/AbstractContainerScreen.java:120)
at shadows.placebo.screen.PlaceboContainerScreen.m_6305_([email protected]/PlaceboContainerScreen.java:20)
at net.minecraftforge.client.ForgeHooksClient.drawScreenInternal([email protected]/ForgeHooksClient.java:441)
at net.minecraftforge.client.ForgeHooksClient.drawScreen([email protected]/ForgeHooksClient.java:434)
at net.minecraft.client.renderer.GameRenderer.m_109093_([email protected]/GameRenderer.java:896)
at net.minecraft.client.Minecraft.m_91383_([email protected]/Minecraft.java:1115)
at net.minecraft.client.Minecraft.m_91374_([email protected]/Minecraft.java:700)
at net.minecraft.client.main.Main.m_239872_([email protected]/Main.java:212)
at net.minecraft.client.main.Main.main([email protected]/Main.java:51)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0([email protected]/Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke([email protected]/Unknown Source)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke([email protected]/Unknown Source)
at java.lang.reflect.Method.invoke([email protected]/Unknown Source)
at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0([email protected]/CommonClientLaunchHandler.java:27)
at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler$$Lambda$936/0x0000000800ff0bc8.run([email protected]/Unknown Source)
at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch([email protected]/LaunchServiceHandlerDecorator.java:30)
at cpw.mods.modlauncher.LaunchServiceHandler.launch([email protected]/LaunchServiceHandler.java:53)
at cpw.mods.modlauncher.LaunchServiceHandler.launch([email protected]/LaunchServiceHandler.java:71)
at cpw.mods.modlauncher.Launcher.run([email protected]/Launcher.java:106)
at cpw.mods.modlauncher.Launcher.main([email protected]/Launcher.java:77)
at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept([email protected]/BootstrapLaunchConsumer.java:26)
at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept([email protected]/BootstrapLaunchConsumer.java:23)
at cpw.mods.bootstraplauncher.BootstrapLauncher.main([email protected]/BootstrapLauncher.java:141)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0([email protected]/Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke([email protected]/Unknown Source)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke([email protected]/Unknown Source)
at java.lang.reflect.Method.invoke([email protected]/Unknown Source)
at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:57)
at java.lang.invoke.LambdaForm$DMH/0x0000000800c02400.invokeStaticInit([email protected]/LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/0x0000000800c02c00.invokeExact_MT([email protected]/LambdaForm$MH)
at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:88)
at org.prismlauncher.EntryPoint.listen(EntryPoint.java:126)
at org.prismlauncher.EntryPoint.main(EntryPoint.java:71)
Added a scuffed workaround for now
I did notice this weird width value here for bounds
: Bounds[x=686, y=236, width=2147482959, height=16]
Exclusions:
exclusion = {ArrayList@95391} size = 7
0 = {Bounds@95400} "Bounds[x=2, y=2, width=144, height=234]"
1 = {Bounds@95401} "Bounds[x=470, y=2, width=216, height=270]"
2 = {Bounds@95402} "Bounds[x=256, y=47, width=176, height=180]"
3 = {Bounds@95403} "Bounds[x=0, y=252, width=256, height=22]"
4 = {Bounds@95404} "Bounds[x=263, y=252, width=162, height=20]"
5 = {Bounds@95405} "Bounds[x=2147483645, y=2147483645, width=5, height=5]"
6 = {Bounds@95406} "Bounds[x=433, y=48, width=29, height=24]"
Maybe a check if the exclusion is within the screen space would work? Seems like it's some element offset into the abyss (for some unknown reason)
@Unique private static int trialAndErrorModifications$attempts;
@Inject(method = "constrainBounds", at = @At("HEAD"))
private static void init(final List<Bounds> exclusion, final Bounds bounds, final ScreenAlign align, int headerOffset, final CallbackInfoReturnable<Bounds> callback) {
trialAndErrorModifications$attempts = 0;
}
@Inject(method = "constrainBounds", at = @At(value = "INVOKE", target = "Ljava/util/List;get(I)Ljava/lang/Object;"), cancellable = true)
private static void addCount(final List<Bounds> exclusion, final Bounds bounds, final ScreenAlign align, int headerOffset, final CallbackInfoReturnable<Bounds> callback) {
trialAndErrorModifications$attempts++;
if (trialAndErrorModifications$attempts > 50) {
if (bounds.empty()) {
callback.setReturnValue(Bounds.EMPTY);
} else {
callback.setReturnValue(bounds);
}
}
}
That's a pretty scary abyss value. Naive bailing would have minor perf concerns, I'd like to properly deal with this.
Might need to use a different workaround, exiting early causes this when I move the Minecraft window to another screen with a different resolution
[05Sep2023 12:35:07.521] [Render thread/ERROR] [net.minecraft.client.Minecraft/FATAL]: Unreported exception thrown!
java.lang.ArithmeticException: / by zero
at dev.emi.emi.screen.EmiScreenManager.constrainBounds(EmiScreenManager.java:334) ~[emi-1.0.19+1.19.2+forge.jar%23614!/:?]
at dev.emi.emi.screen.EmiScreenManager.createScreenSpace(EmiScreenManager.java:283) ~[emi-1.0.19+1.19.2+forge.jar%23614!/:?]
at dev.emi.emi.screen.EmiScreenManager.recalculate(EmiScreenManager.java:204) ~[emi-1.0.19+1.19.2+forge.jar%23614!/:?]
at dev.emi.emi.screen.EmiScreenManager.forceRecalculate(EmiScreenManager.java:227) ~[emi-1.0.19+1.19.2+forge.jar%23614!/:?]
at dev.emi.emi.screen.EmiScreenManager.addWidgets(EmiScreenManager.java:777) ~[emi-1.0.19+1.19.2+forge.jar%23614!/:?]
at net.minecraft.client.gui.screens.Screen.handler$cnc000$init(Screen.java:3746) ~[client-1.19.2-20220805.130853-srg.jar%23843!/:?]
at net.minecraft.client.gui.screens.Screen.m_6575_(Screen.java:416) ~[client-1.19.2-20220805.130853-srg.jar%23843!/:?]
at net.minecraft.client.gui.screens.Screen.m_6574_(Screen.java:517) ~[client-1.19.2-20220805.130853-srg.jar%23843!/:?]
at net.p3pp3rf1y.sophisticatedcore.client.gui.StorageScreenBase.m_6574_(StorageScreenBase.java:122) ~[sophisticatedcore-1.19.2-0.5.87.417.jar%23774!/:1.19.2-0.5.87.417]
at net.minecraft.client.Minecraft.m_5741_(Minecraft.java:1245) ~[client-1.19.2-20220805.130853-srg.jar%23843!/:?]
at com.mojang.blaze3d.platform.Window.m_85415_(Window.java:292) ~[client-1.19.2-20220805.130853-srg.jar%23843!/:?]
at org.lwjgl.glfw.GLFWFramebufferSizeCallbackI.callback(GLFWFramebufferSizeCallbackI.java:44) ~[lwjgl-glfw-3.3.1.jar%2384!/:build 7]
at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.1.jar%2396!/:build 7]
at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3403) ~[lwjgl-glfw-3.3.1.jar%2384!/:build 7]
at com.mojang.blaze3d.systems.RenderSystem.m_69495_(RenderSystem.java:204) ~[client-1.19.2-20220805.130853-srg.jar%23843!/:?]
at com.mojang.blaze3d.platform.Window.m_85435_(Window.java:337) ~[client-1.19.2-20220805.130853-srg.jar%23843!/:?]
at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1143) ~[client-1.19.2-20220805.130853-srg.jar%23843!/:?]
at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:700) ~[client-1.19.2-20220805.130853-srg.jar%23843!/:?]
at net.minecraft.client.main.Main.m_239872_(Main.java:212) ~[client-1.19.2-20220805.130853-srg.jar%23843!/:?]
at net.minecraft.client.main.Main.main(Main.java:51) ~[client-1.19.2-20220805.130853-srg.jar%23843!/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:27) ~[fmlloader-1.19.2-43.2.21.jar%23150!/:?]
at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23137!/:?]
at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23137!/:?]
at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23137!/:?]
at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23137!/:?]
at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23137!/:?]
at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23137!/:?]
at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23137!/:?]
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(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
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:?]
Changed what I'm doing now, which fixes that:
@Inject(method = "constrainBounds", at = @At(value = "HEAD"))
private static void addCount(final List<Bounds> exclusion, final Bounds bounds, final ScreenAlign align, int headerOffset, final CallbackInfoReturnable<Bounds> callback) {
for (int i = 0; i < exclusion.size(); i++) {
Bounds entry = exclusion.get(i);
if (Math.abs(entry.x()) > 5000 || Math.abs(entry.y()) > 5000) {
exclusion.remove(entry);
i--;
}
}
}