bowser0000 / SkyblockMod

QOL changes that enhances your Hypixel Skyblock experience.
GNU Lesser General Public License v3.0
203 stars 91 forks source link

[BUG/FREEZE] Skilltracker.onChat causes Client Thread to be blocked indefinetly #162

Open gtulol opened 9 months ago

gtulol commented 9 months ago

Random frequent freezes led me to profile this issue, seems to happen from this https://github.com/bowser0000/SkyblockMod/blob/development/src/main/java/me/Danker/features/SkillTracker.java#L63 or maybe the for-each underneath?

jstack -F \ -> https://pastebin.com/eXkVhqX1

important part: Client Thread Stacktrace:

Thread 1: (state = BLOCKED)

hashmapenjoyer commented 2 months ago

Edit: I am an idiot, this is 6 months old. Has this gone away on its own?

When you say freezes, do you mean frame drops or a full-on game crash? If it's just a performance issue, it's possible that precompiling the pattern outside this event handler as a class-level variable would help:

Pattern pattern = Pattern.compile(" {3,}");

And then just use this inside onChat:

String[] actionBarSections = pattern.split(event.message.getUnformattedText());

I have very little experience with modding/java, though, so this is just a guess from a random programmer.

gtulol commented 2 months ago

hi, what i mean by freeze: the game locks up completetly and becomes unresponsive due to the main thread (Client Thread) being blocked. i'm not very familiar with precompiling the pattern etc, don't know whether this still is an issue but i would guess, just was barely playing in recent months due to moving but i noticed that i couldn't replicate this bug on JRE 8 subverion 352 as opposed to the default 51 (minecraft launcher "jre-legacy") where implementations of relevant classes changed ¯_(ツ)_/¯