AppleSkin

AppleSkin

241M Downloads

Hidden hearts bug thingy with saturation overlay causes not enough RAM.

FrostFizzie opened this issue ยท 6 comments

commented
2023-09-17.12-02-00.mp4

Error from log:

[11:44:01] [Render thread/ERROR]: Out of memory
java.lang.OutOfMemoryError: Requested array size exceeds VM limit
at java.util.Arrays.copyOf(Arrays.java:3481) ~[?:?]
at java.util.Vector.grow(Vector.java:262) ~[?:?]
at java.util.Vector.setSize(Vector.java:281) ~[?:?]
at squeek.appleskin.client.HUDOverlayHandler.generateBarOffsets(HUDOverlayHandler.java:488) ~[appleskin-fabric-mc1.20-2.5.0.jar:?]
at squeek.appleskin.client.HUDOverlayHandler.onRender(HUDOverlayHandler.java:93) ~[appleskin-fabric-mc1.20-2.5.0.jar:?]
at net.minecraft.class_329.handler$zzc000$appleskin$renderFoodPost(class_329.java:2379) ~[client-intermediary.jar:?]
at net.minecraft.class_329.method_1760(class_329.java:862) ~[client-intermediary.jar:?]
at net.minecraft.class_329.method_1753(class_329.java:214) ~[client-intermediary.jar:?]
at net.minecraft.class_757.method_3192(class_757.java:926) ~[client-intermediary.jar:?]
at net.minecraft.class_310.method_1523(class_310.java:1219) ~[client-intermediary.jar:?]
at net.minecraft.class_310.method_1514(class_310.java:802) ~[client-intermediary.jar:?]
at net.minecraft.client.main.Main.main(Main.java:250) ~[minecraft-1.20.1-client.jar:?]
at java.lang.invoke.LambdaForm$DMH/0x0000000801204000.invokeStaticInit(LambdaForm$DMH) ~[?:?]
at java.lang.invoke.LambdaForm$MH/0x00000008013cc000.invokeExact_MT(LambdaForm$MH) ~[?:?]
at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468) ~[fabric-loader-0.14.22.jar:?]
at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.14.22.jar:?]
at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.14.22.jar:?]
at java.lang.invoke.LambdaForm$DMH/0x0000000801003400.invokeStatic(LambdaForm$DMH) ~[?:?]
at java.lang.invoke.LambdaForm$MH/0x0000000801004400.invoke(LambdaForm$MH) ~[?:?]
at java.lang.invoke.Invokers$Holder.invokeExact_MT(Invokers$Holder) ~[?:?]
at jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(DirectMethodHandleAccessor.java:155) ~[?:?]
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:578) ~[?:?]
at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:243) ~[NewLaunch.jar:?]
at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:278) ~[NewLaunch.jar:?]
at org.multimc.EntryPoint.listen(EntryPoint.java:143) ~[NewLaunch.jar:?]
at org.multimc.EntryPoint.main(EntryPoint.java:34) ~[NewLaunch.jar:?]
[11:44:06] [Render thread/ERROR]: Signature is missing from Property textures
[11:44:07] [Render thread/INFO]: Connecting to mcdiamondfire.com, 25565
[11:44:11] [Render thread/ERROR]: Signature is missing from Property textures
[11:44:12] [Render thread/INFO]: Generating YACL screen
[11:44:12] [Render thread/ERROR]: Invalid mod icon for icon source essential: assets/essential/textures/essential.png
java.nio.file.NoSuchFileException: /assets/essential/textures/essential.png
at jdk.nio.zipfs.ZipFileSystem.newInputStream(ZipFileSystem.java:861) ~[jdk.zipfs:?]
at jdk.nio.zipfs.ZipPath.newInputStream(ZipPath.java:755) ~[jdk.zipfs:?]
at jdk.nio.zipfs.ZipFileSystemProvider.newInputStream(ZipFileSystemProvider.java:261) ~[jdk.zipfs:?]
at java.nio.file.Files.newInputStream(Files.java:160) ~[?:?]
at com.terraformersmc.modmenu.util.mod.fabric.FabricIconHandler.createIcon(FabricIconHandler.java:34) ~[modmenu-7.1.0.jar:?]
at com.terraformersmc.modmenu.util.mod.fabric.FabricMod.getIcon(FabricMod.java:159) ~[modmenu-7.1.0.jar:?]
at com.terraformersmc.modmenu.gui.widget.entries.ModListEntry.getIconTexture(ModListEntry.java:130) ~[modmenu-7.1.0.jar:?]
at com.terraformersmc.modmenu.gui.widget.entries.ModListEntry.method_25343(ModListEntry.java:59) ~[modmenu-7.1.0.jar:?]
at com.terraformersmc.modmenu.gui.widget.entries.ParentEntry.method_25343(ParentEntry.java:35) ~[modmenu-7.1.0.jar:?]
at com.terraformersmc.modmenu.gui.widget.ModListWidget.method_25311(ModListWidget.java:233) ~[modmenu-7.1.0.jar:?]
at net.minecraft.class_350.method_25394(class_350.java:227) ~[client-intermediary.jar:?]
at com.terraformersmc.modmenu.gui.ModsScreen.method_25394(ModsScreen.java:285) ~[modmenu-7.1.0.jar:?]
at net.minecraft.class_437.method_47413(class_437.java:110) ~[client-intermediary.jar:?]
at net.minecraft.class_757.method_3192(class_757.java:945) ~[client-intermediary.jar:?]
at net.minecraft.class_310.method_1523(class_310.java:1219) ~[client-intermediary.jar:?]
at net.minecraft.class_310.method_1514(class_310.java:802) ~[client-intermediary.jar:?]
at net.minecraft.client.main.Main.main(Main.java:250) ~[minecraft-1.20.1-client.jar:?]
at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468) ~[fabric-loader-0.14.22.jar:?]
at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.14.22.jar:?]
at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.14.22.jar:?]
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:578) ~[?:?]
at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:243) ~[NewLaunch.jar:?]
at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:278) ~[NewLaunch.jar:?]
at org.multimc.EntryPoint.listen(EntryPoint.java:143) ~[NewLaunch.jar:?]
at org.multimc.EntryPoint.main(EntryPoint.java:34) ~[NewLaunch.jar:?]

commented

What is "Hidden hearts bug thingy"?

commented

Strange, we do have some protection for this:

// Special case for infinite/NaN. Infinite absorption has been seen in the wild.
// This will effectively disable rendering while health is infinite.
if (!Float.isFinite(maxHealth + absorptionHealth))
healthBars = 0;

but it looks like it's not working in your case. Maybe your health/absorption is just really, really big instead of actually infinite.

Here's the original issue where this same bug was reported and thought to be fixed: #127

Can you provide any info about how you got so many hearts?

commented

What is "Hidden hearts bug thingy"?

Where you have soo many hearts that the heart renderer doesn't render any hearts like in the video where you can see hunger, and xp but no hearts.

commented

Mini-game creation server, so at a technical standpoint ig; Plugins.

commented

Just putting this here for completeness, the fix will probably just be to limit the number of hearts to something reasonable (1000 or so most likely):

  • The number of hearts as calculated by Minecraft's HUD uses MathHelper.ceil which involves casting to an int.
  • Floats that exceed Integer.MAX_VALUE when casted to an int get interpretted as negative:
      @Test
      void ceilLimits()
      {
      	float maxIntAsFloat = (float) Integer.MAX_VALUE;
      	Assertions.assertEquals(maxIntAsFloat, MathHelper.ceil(maxIntAsFloat));
    
      	float largerThanMaxInt = Math.nextUp(maxIntAsFloat);
      	Assertions.assertEquals(largerThanMaxInt, MathHelper.ceil(largerThanMaxInt));
      }
    • The first assert succeeds, but the second fails with: Expected: 2.1474839E9, Actual: -2.14748365E9
  • This effectively means that the 'hidden hearts bug thingy' relies on a quirk of the MathHelper.ceil function (#127 (comment) contains more details on this)

For our purposes, Integer.MAX_VALUE would also be too large (that'd be something like 16GiB of memory needed for our healthBarOffsets list), so emulating the 'limit' of Minecraft's HUD is not the way to go here. As mentioned, some reasonable (very low) upper bound would make more sense.