GregTechCEu / GregTech

GregTech CE 1.12 fork continuing progression and development
GNU Lesser General Public License v3.0
252 stars 177 forks source link

OreDict Filter Freezing Gaming #1480

Closed Correlander closed 1 year ago

Correlander commented 1 year ago

GregTech CEu Version

v2.5.0

Modpack Used

Nomifactory CEU

Addons Installed

No response

Environment

Forge Server, but I can reproduce in singleplayer.

New Worlds

Yes

Cross-Mod Interaction

Unsure

Expected Behavior

Normally when the text hits the edge of the window it makes a new line and you are able to scroll down etc.

Actual Behavior

Instead of a line break, it just keeps going off the edge of my screen. Eventually, it won't let you type anymore after going off the screen for a bit, but it won't freeze. It only freezes if you use operators. The only one I tested with while reproducing in singleplayer was !, which successfully froze my game. Can't say 100% for the others. 211977153-62812fb2-5321-4927-b280-2401e7e0782a

Steps to Reproduce

Type in the spot where you type for an oredict filter. Continue typing. If it goes out of the window something is already wrong, but even further typing a ! will make things more wrong with a game freeze.

Additional Information

No response

IntegerLimit commented 1 year ago

Logs and more information here: https://github.com/tracer4b/nomi-ceu/issues/198

LAGIdiot commented 1 year ago

Confirmed on latest master 1fae38416de4b76fe0c3bd1c72d1463e1abc03b9 . Unfortunately there is nothing useful in logs.

Problem occurs even if text is not written on "outside" of the box. I was able to replicate it on: dustTiny* - save successful dustTiny* & !dust*SiliconeDioxide - freeze But only once, after game restart it is working without problem.

When game is in frozen state, it is just trying to match the regex which is called from: https://github.com/GregTechCEu/GregTech/blob/d12ed26ba7b8a8dbf3dc7f20c2f41406e2374756/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java#L351 I got to point where my stack was 300+ calls deep all in regex matcher.

Given my observations this problem is related to checking if last typed char is valid. This is done on every keystroke. And it is taking longer and longer with each character. Then it gets to point when it starts freezing game.

Correlander commented 1 year ago

Confirmed on latest master 1fae384 . Unfortunately there is nothing useful in logs.

Problem occurs even if text is not written on "outside" of the box. I was able to replicate it on: dustTiny* - save successful dustTiny* & !dust*SiliconeDioxide - freeze But only once, after game restart it is working without problem.

When game is in frozen state, it is just trying to match the regex which is called from:

https://github.com/GregTechCEu/GregTech/blob/d12ed26ba7b8a8dbf3dc7f20c2f41406e2374756/src/main/java/gregtech/api/gui/widgets/TextFieldWidget2.java#L351

I got to point where my stack was 300+ calls deep all in regex matcher. Given my observations this problem is related to checking if last typed char is valid. This is done on every keystroke. And it is taking longer and longer with each character. Then it gets to point when it starts freezing game.

I had a different experience, when it froze it didn't type the character I had hit. After restart it was like that character was never typed, though I'm not sure if that's important to the issue.