Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
FrostFizzie opened this issue Sep 17, 2023 · 6 comments
Closed

Comments

@FrostFizzie
Copy link

FrostFizzie commented Sep 17, 2023

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:?]

@squeek502
Copy link
Owner

What is "Hidden hearts bug thingy"?

@FrostFizzie
Copy link
Author

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.

@squeek502
Copy link
Owner

squeek502 commented Sep 17, 2023

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?

@FrostFizzie
Copy link
Author

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

@squeek502
Copy link
Owner

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 (Saturation hud overlay causing Out of Memory error #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.

squeek502 added a commit that referenced this issue Sep 27, 2023
…ly large

Avoids a potential 'Out of memory' exception when trying to resize healthBarOffsets to an absurdly large size due to maxHealth or absorption being extremely large/infinite.

See #266
squeek502 added a commit that referenced this issue Sep 27, 2023
…ly large

Avoids a potential 'Out of memory' exception when trying to resize healthBarOffsets to an absurdly large size due to maxHealth or absorption being extremely large/infinite.

See #266
@squeek502
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants