Shadows-of-Fire / Toast-Control

Because Mojang can't into popups.
MIT License
14 stars 6 forks source link

IndexOutOfBoundsException when joining a FTB Skies server #32

Open DisruptionSystemsINC opened 1 year ago

DisruptionSystemsINC commented 1 year ago

Title pretty much explains it, the client throws this exception:

[18May2023 20:25:56.561] [Render thread/ERROR] [net.minecraft.client.Minecraft/FATAL]: Unreported exception thrown! java.lang.IndexOutOfBoundsException: Index 2 out of bounds for length 2 at jdk.internal.util.Preconditions.outOfBounds(Unknown Source) ~[?:?] at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Unknown Source) ~[?:?] at jdk.internal.util.Preconditions.checkIndex(Unknown Source) ~[?:?] at java.util.Objects.checkIndex(Unknown Source) ~[?:?] at java.util.ArrayList.get(Unknown Source) ~[?:?] at shadows.toaster.BetterToastComponent.lambda$render$2(BetterToastComponent.java:48) ~[ToastControl-1.19.2-7.0.0.jar%23745!/:7.0.0] at java.util.ArrayDeque.bulkRemoveModified(Unknown Source) ~[?:?] at java.util.ArrayDeque.bulkRemove(Unknown Source) ~[?:?] at java.util.ArrayDeque.removeIf(Unknown Source) ~[?:?] at shadows.toaster.BetterToastComponent.m_94920_(BetterToastComponent.java:41) ~[ToastControl-1.19.2-7.0.0.jar%23745!/:7.0.0] at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1117) ~[client-1.19.2-20220805.130853-srg.jar%23763!/:?] at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:700) ~[client-1.19.2-20220805.130853-srg.jar%23763!/:?] at net.minecraft.client.main.Main.m_239872_(Main.java:212) ~[client-1.19.2-20220805.130853-srg.jar%23763!/:?] at net.minecraft.client.main.Main.main(Main.java:51) ~[client-1.19.2-20220805.130853-srg.jar%23763!/:?] 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.11.jar%23101!/:?] at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%2388!/:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%2388!/:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%2388!/:?] at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%2388!/:?] at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%2388!/:?] at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%2388!/:?] at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%2388!/:?] at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?]

Modpack is FTB Skies 1.1.0, with the latest server version from the FTB page Full crash log here latest.log

TheFlash787 commented 1 year ago

+1 this happens fairly frequently.

TheFlash787 commented 1 year ago

Looks like this might actually have been fixed but not included in a release. @Shadows-of-Fire do you have any plans to make a new released build for 1.19.2?

kirinotkiri commented 7 months ago

It seems to have occurred during a call to set occupied index in the render method of BetterToastComponent.

I also encounter this error along with others in my server, this error started occurring after the server disabled enforce server profile. It is difficult to pinpoint exactly the mechanism of this error since it triggers inconsistently, sometimes not, sometimes it does, sometimes it does repeatedly, and sometimes not at all for a while.

The blame could potentially be placed upon the "Chat message unverified" Toast shown by minecraft during login, again, mechanism not yet clear.

As for my personal fix I implemented a rather crude one, where I simply wrapped the section of code in the render method mentioned above within a try catch loop, where it will detect the array out of bounds exception and retry up to two attempts before giving up. So far it seems to have worked.

If speculation is to be welcome, a change to the toast queue occurs in between the call to get free indexes and the actual call to set occupied index due to the unverified toast message sent by minecraft, therefore causing disparity between the obtained index and actual array size.

MrTailson commented 4 months ago

Still getting this crash. A friend of mine tried to join my server via Essentials, but keep getting this error every time they tried to join.