Skin Layers 3D (Fabric/Forge)

Skin Layers 3D (Fabric/Forge)

47M Downloads

Massive log spam and a potential deadlock when viewing heads from Head Index

SplendidAlakey opened this issue ยท 8 comments

commented

MC 1.19.2
FAPI 0.75.1
3DSkinLayers 1.5.2
Head Index 1.0.9

To reproduce simply install both mods, launch the game, type /head menu in chat and browse around, look through at least a couple of pages.

On an almost vanilla instance, doing so will just massively spam the logs, but shouldn't cause more issues, however, on a heavily modded instance, that can cause a deadlock and a subsequent OOM crash.

This can also happen with any other mod, that adds custom player heads, however Head Index is the easiest to reproduce the issue with, because it renders lots of heads at once.

Logs: https://gist.github.com/SplendidAlakey/ecc1fc62259213bb44d857d6053dde56

commented

Not really a bug, Head Index loads the skin textures incorrectly(not in a Vanilla friendly way that this mod is able to handle). https://github.com/tr7zw/3d-Skin-Layers/blob/1.19.3/Shared/src/main/java/dev/tr7zw/skinlayers/SkinUtil.java#L104 the code should be doing exactly nothing(since it's not a HttpTexture which any vanilla skin uses or DynamicTexture). Can you verify the OOM doesn't happen from Head Index leaking the textures?

commented

Can you verify the OOM doesn't happen from Head Index leaking the textures?

If you could tell me how to do that. All I can say right now is that not having 3D Skin Layers lets me browse as many tabs as I can in Head Index and not run out of memory on my heavily modded instance.

commented

The only thing that should be able to happen is here: https://github.com/tr7zw/3d-Skin-Layers/blob/1.19.3/Shared/src/main/java/dev/tr7zw/skinlayers/mixin/BlockEntityWithoutLevelRendererMixin.java#L68 where a cache gets filled with these items(so the 3d model doesn't get rebuilt each frame). But thats an empty object in that case, and the map is a WeakHashMap. This means, as soon as the item isn't references any more and gets gc'd, the cached data is gone too. I think I see the issue on why the log gets spammed(in the line above, the ok/not ok from the setup3dLayers doesn't get cached, so if it fails, it will retry each frame(thats bad, will have to be fixed). Still not seeing how this could result in a memory leak(other than it eating performance with these "invalid" player heads).

commented

Give it a try with this change(download from the actions tab above, click the 1.19.2 version then Artifact at the bottom). Now it shouldn't spam the log, hopefully fixing whatever caused the other weirdness. Also prints some more info in the message(it will only show up once), on what that head texture is.

commented

The build seems to work perfectly, thank you! No spam and no deadlocking. Will close this, when it's released.

The only error I'm getting now is this, it was also present in the original logs, just buried among the spam:

[00:39:30] [Render thread/WARN]: Error while loading the skin texture
java.io.IOException: Could not load image: Image not of any known type, or corrupt
	at net.minecraft.class_1011.method_4303(class_1011.java:135) ~[transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_1011.method_4310(class_1011.java:109) ~[transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_1011.method_4309(class_1011.java:100) ~[transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_1046.method_22795(class_1046.java:144) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_1046.getImage(class_1046.java:527) [transformed-mod-minecraft.i0:0/:?]
	at dev.tr7zw.skinlayers.SkinUtil.getTexture(SkinUtil.java:70) [transformed-mod-skinlayers.i0:0/:?]
	at dev.tr7zw.skinlayers.SkinUtil.setup3dLayers(SkinUtil.java:159) [transformed-mod-skinlayers.i0:0/:?]
	at net.minecraft.class_756.handler$zzc000$renderByItem(class_756.java:570) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_756.method_3166(class_756.java) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_918.method_23179(class_918.java:133) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_918.method_4021(class_918.java:307) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_918.method_4026(class_918.java:350) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_918.method_36543(class_918.java:340) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_918.method_27951(class_918.java:336) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_465.method_2385(class_465.java:264) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_465.method_25394(class_465.java:122) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_476.method_25394(class_476.java:31) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_757.method_3192(class_757.java:881) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_310.method_1523(class_310.java:1177) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.class_310.method_1514(class_310.java:768) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.client.main.Main.method_44604(Main.java:244) [transformed-mod-minecraft.i0:0/:?]
	at net.minecraft.client.main.Main.main(Main.java:51) [transformed-mod-minecraft.i0:0/:?]
	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 org.quiltmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:527) [quilt-loader-0.18.3.jar:?]
	at org.quiltmc.loader.impl.launch.knot.Knot.launch(Knot.java:82) [quilt-loader-0.18.3.jar:?]
	at org.quiltmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:28) [quilt-loader-0.18.3.jar:?]
	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:?]
commented

Huh, thats some mc internal error when trying to load the image. Not much I can do I guess, looks like the mod is downloading corrupted files or some custom format that vanilla can't load. Not that important I guess?

commented

It doesn't seem to actually cause any issues, so no, not that important. Just letting you know in case it was. There are no other errors at all now.

commented

Ok good. I'll close the issue, since the main part has been solved.