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

ArrayIndexOutOfBoundsException in MobSpawnEspHack.java #978

Open
2 tasks done
tolland opened this issue Apr 6, 2024 · 4 comments
Open
2 tasks done

ArrayIndexOutOfBoundsException in MobSpawnEspHack.java #978

tolland opened this issue Apr 6, 2024 · 4 comments
Labels
status:unconfirmed New issue. Needs triage. type:bug Something isn't working

Comments

@tolland
Copy link

tolland commented Apr 6, 2024

Pre-reporting checklist

  • I have searched existing issues and didn't find any previous reports of this bug.
  • This bug still happens in the latest version of Wurst. I've made sure my installation is up to date.

Description

During mining or breaking blocks fast, the client crashes with return code 255, with a wurst exception from MobSpawnEspHack: (this happens intermittently about once a day or so) but typically when I am breaking lots of blocks such as mining with good pick, or breaking something like sugarcane.

No other breaking block hack is active. (i.e. fastbreak, excavator, nuker) however MobSpawnEsp is active.

I've been trying variations to try and reproduce the bug in a simple repeatable environment. But so far I cannot, and only experience this behaviour on a fairly busy server, with various mods running locally. (if I remove all local mods, and run against vanilla server it does not reproduce). It seems likely that it is this set of circumstances (busy server, plugins, other local mods) which trigger a fairly rare set of conditions required for the exception.

Repro steps

  1. Currently running baritone, fabric, tweakeroo, litematica
  2. break blocks fast. e.g. mining in nether, breaking sugarcane etc, or use baritone
  3. client crashes with 255 and the above stack trace intermittently

Wurst Client version

v7.41.2-MC1.20.4

Minecraft version

1.20.4 with Fabric Loader 0.15.7

Crash report (if applicable)

---- Minecraft Crash Report ----
// Oops.

Time: 2024-04-06 11:14:24
Description: Firing Wurst event

java.lang.ArrayIndexOutOfBoundsException: Index 133 out of bounds for length 133
	at java.base/java.util.HashMap.keysToArray(HashMap.java:950)
	at java.base/java.util.HashSet.toArray(HashSet.java:368)
	at java.base/java.util.ArrayList.<init>(ArrayList.java:181)
	at net.wurstclient.hacks.MobSpawnEspHack$ChunkScanner.compileBuffer(MobSpawnEspHack.java:307)
	at net.wurstclient.hacks.MobSpawnEspHack.onUpdate(MobSpawnEspHack.java:144)
	at net.wurstclient.events.UpdateListener$UpdateEvent.fire(UpdateListener.java:27)
	at net.wurstclient.event.EventManager.fireImpl(EventManager.java:69)
	at net.wurstclient.event.EventManager.fire(EventManager.java:42)
	at net.minecraft.class_746.handler$bhp000$wurst$onTick(class_746.java:3372)
	at net.minecraft.class_746.method_5773(class_746.java:218)
	at net.minecraft.class_638.method_18646(class_638.java:277)
	at net.minecraft.class_1937.method_18472(class_1937.java:492)
	at net.minecraft.class_638.method_32124(class_638.java:260)
	at net.minecraft.class_5574.method_31791(class_5574.java:54)
	at net.minecraft.class_638.method_18116(class_638.java:256)
	at net.minecraft.class_310.method_1574(class_310.java:2011)
	at net.minecraft.class_310.method_1523(class_310.java:1289)
	at net.minecraft.class_310.method_1514(class_310.java:888)
	at net.minecraft.client.main.Main.main(Main.java:265)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.polymc.impl.OneSixLauncher.invokeMain(OneSixLauncher.java:104)
	at org.polymc.impl.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:176)
	at org.polymc.impl.OneSixLauncher.launch(OneSixLauncher.java:186)
	at org.polymc.EntryPoint.listen(EntryPoint.java:144)
	at org.polymc.EntryPoint.main(EntryPoint.java:74)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
	at java.base/java.util.HashMap.keysToArray(HashMap.java:950)
	at java.base/java.util.HashSet.toArray(HashSet.java:368)
	at java.base/java.util.ArrayList.<init>(ArrayList.java:181)
	at net.wurstclient.hacks.MobSpawnEspHack$ChunkScanner.compileBuffer(MobSpawnEspHack.java:307)
	at net.wurstclient.hacks.MobSpawnEspHack.onUpdate(MobSpawnEspHack.java:144)
	at net.wurstclient.events.UpdateListener$UpdateEvent.fire(UpdateListener.java:27)
	at net.wurstclient.event.EventManager.fireImpl(EventManager.java:69)
	at net.wurstclient.event.EventManager.fire(EventManager.java:42)
	at net.minecraft.class_746.handler$bhp000$wurst$onTick(class_746.java:3372)
	at net.minecraft.class_746.method_5773(class_746.java:218)
	at net.minecraft.class_638.method_18646(class_638.java:277)
	at net.minecraft.class_1937.method_18472(class_1937.java:492)
	at net.minecraft.class_638.method_32124(class_638.java:260)
	at net.minecraft.class_5574.method_31791(class_5574.java:54)
	at net.minecraft.class_638.method_18116(class_638.java:256)

-- Affected event --
Details:
	Event class: net.wurstclient.events.UpdateListener$UpdateEvent
Stacktrace:
	at net.wurstclient.event.EventManager.fireImpl(EventManager.java:69)
	at net.wurstclient.event.EventManager.fire(EventManager.java:42)
	at net.minecraft.class_746.handler$bhp000$wurst$onTick(class_746.java:3372)
	at net.minecraft.class_746.method_5773(class_746.java:218)
	at net.minecraft.class_638.method_18646(class_638.java:277)
	at net.minecraft.class_1937.method_18472(class_1937.java:492)
	at net.minecraft.class_638.method_32124(class_638.java:260)
	at net.minecraft.class_5574.method_31791(class_5574.java:54)
	at net.minecraft.class_638.method_18116(class_638.java:256)
	at net.minecraft.class_310.method_1574(class_310.java:2011)
	at net.minecraft.class_310.method_1523(class_310.java:1289)
	at net.minecraft.class_310.method_1514(class_310.java:888)
	at net.minecraft.client.main.Main.main(Main.java:265)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.polymc.impl.OneSixLauncher.invokeMain(OneSixLauncher.java:104)
	at org.polymc.impl.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:176)
	at org.polymc.impl.OneSixLauncher.launch(OneSixLauncher.java:186)
	at org.polymc.EntryPoint.listen(EntryPoint.java:144)
	at org.polymc.EntryPoint.main(EntryPoint.java:74)

-- Entity being ticked --
Details:
	Entity Type: minecraft:player (net.minecraft.class_746)
	Entity ID: 109939
	Entity Name: MyPlayer
	Entity's Exact location: 3403.66, 47.00, -5187.08
	Entity's Block location: World: (3403,47,-5188), Section: (at 11,15,12 in 212,2,-325; chunk contains blocks 3392,-64,-5200 to 3407,319,-5185), Region: (6,-11; contains chunks 192,-352 to 223,-321, blocks 3072,-64,-5632 to 3583,319,-5121)
	Entity's Momentum: 0.00, -0.08, 0.00
	Entity's Passengers: []
	Entity's Vehicle: null
Stacktrace:
	at net.minecraft.class_1937.method_18472(class_1937.java:492)
	at net.minecraft.class_638.method_32124(class_638.java:260)
	at net.minecraft.class_5574.method_31791(class_5574.java:54)
	at net.minecraft.class_638.method_18116(class_638.java:256)
	at net.minecraft.class_310.method_1574(class_310.java:2011)
	at net.minecraft.class_310.method_1523(class_310.java:1289)
	at net.minecraft.class_310.method_1514(class_310.java:888)
	at net.minecraft.client.main.Main.main(Main.java:265)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.polymc.impl.OneSixLauncher.invokeMain(OneSixLauncher.java:104)
	at org.polymc.impl.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:176)
	at org.polymc.impl.OneSixLauncher.launch(OneSixLauncher.java:186)
	at org.polymc.EntryPoint.listen(EntryPoint.java:144)
	at org.polymc.EntryPoint.main(EntryPoint.java:74)

-- Uptime --
Details:
	JVM uptime: 49855.813s
	Wall uptime: 49847.648s
	High-res time: 49843.496s
	Client ticks: 683344 ticks / 34167.200s
Stacktrace:
	at net.minecraft.class_310.method_1587(class_310.java:2564)
	at net.minecraft.class_310.method_54580(class_310.java:995)
	at net.minecraft.class_310.method_1514(class_310.java:908)
	at net.minecraft.client.main.Main.main(Main.java:265)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.polymc.impl.OneSixLauncher.invokeMain(OneSixLauncher.java:104)
	at org.polymc.impl.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:176)
	at org.polymc.impl.OneSixLauncher.launch(OneSixLauncher.java:186)
	at org.polymc.EntryPoint.listen(EntryPoint.java:144)
	at org.polymc.EntryPoint.main(EntryPoint.java:74)

-- Affected level --
Details:
	All players: 1 total; [class_746['MyPlayer'/109939, l='ClientLevel', x=3403.66, y=47.00, z=-5187.08]]
	Chunk stats: 1089, 705
	Level dimension: minecraft:overworld
	Level spawn location: World: (3472,57,-5204), Section: (at 0,9,12 in 217,3,-326; chunk contains blocks 3472,-64,-5216 to 3487,319,-5201), Region: (6,-11; contains chunks 192,-352 to 223,-321, blocks 3072,-64,-5632 to 3583,319,-5121)
	Level time: 473159209 game time, 531063320 day time
	Server brand: BungeeCord (git:BungeeCord-Bootstrap:1.20-R0.2-SNAPSHOT:19918c6:1788) <- §fMistylands§r
	Server type: Non-integrated multiplayer server
	Tracked entity count: 32

-- Last reload --
Details:
	Reload number: 1
	Reload reason: initial
	Finished: Yes
	Packs: vanilla, fabric, cloth-config, fabric-api, fabric-api-base, fabric-api-lookup-api-v1, fabric-biome-api-v1, fabric-block-api-v1, fabric-block-view-api-v2, fabric-blockrenderlayer-v1, fabric-client-tags-api-v1, fabric-command-api-v1, fabric-command-api-v2, fabric-commands-v0, fabric-containers-v0, fabric-content-registries-v0, fabric-convention-tags-v1, fabric-crash-report-info-v1, fabric-data-attachment-api-v1, fabric-data-generation-api-v1, fabric-dimensions-v1, fabric-entity-events-v1, fabric-events-interaction-v0, fabric-events-lifecycle-v0, fabric-game-rule-api-v1, fabric-item-api-v1, fabric-item-group-api-v1, fabric-key-binding-api-v1, fabric-keybindings-v0, fabric-language-kotlin, fabric-lifecycle-events-v1, fabric-loot-api-v2, fabric-message-api-v1, fabric-mining-level-api-v1, fabric-model-loading-api-v1, fabric-models-v0, fabric-networking-api-v1, fabric-object-builder-api-v1, fabric-particles-v1, fabric-recipe-api-v1, fabric-registry-sync-v0, fabric-renderer-api-v1, fabric-renderer-indigo, fabric-renderer-registries-v1, fabric-rendering-data-attachment-v1, fabric-rendering-fluids-v1, fabric-rendering-v0, fabric-rendering-v1, fabric-resource-conditions-api-v1, fabric-resource-loader-v0, fabric-screen-api-v1, fabric-screen-handler-api-v1, fabric-sound-api-v1, fabric-transfer-api-v1, fabric-transitive-access-wideners-v1, fabricloader, forgeconfigapiport, litematica, magiclib, magiclib-1_20_4, malilib, masa_gadget_mod, masa_gadget_mod-1_20_4, minihud, modmenu, shulkerboxtooltip, tweakeroo, worldedit, worldeditcui, worldtools, wurst, xaerominimap, xaeroworldmap

-- System Details --
Details:
	Minecraft Version: 1.20.4
	Minecraft Version ID: 1.20.4
	Operating System: Linux (amd64) version 6.7.9-100.fc38.x86_64
	Java Version: 17.0.9, Red Hat, Inc.
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Red Hat, Inc.
	Memory: 645975176 bytes (616 MiB) / 3019898880 bytes (2880 MiB) up to 4294967296 bytes (4096 MiB)
	CPUs: 8
	Processor Vendor: GenuineIntel
	Processor Name: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
	Identifier: Intel64 Family 6 Model 94 Stepping 3
	Microarchitecture: Skylake (Client)
	Frequency (GHz): 4.00
	Number of physical packages: 1
	Number of physical CPUs: 4
	Number of logical CPUs: 8
	Graphics card #0 name: GP104 [GeForce GTX 1080]
	Graphics card #0 vendor: NVIDIA Corporation (0x10de)
	Graphics card #0 VRAM (MB): 288.00
	Graphics card #0 deviceId: 0x1b80
	Graphics card #0 versionInfo: unknown
	Virtual memory max (MB): 32110.73
	Virtual memory used (MB): 23776.12
	Swap memory total (MB): 8056.00
	Swap memory used (MB): 2772.00
	JVM Flags: 2 total; -Xms512m -Xmx4096m
	Fabric Mods: 
		baritone: Baritone 1.10.2
			dev_babbaj_nether-pathfinder: nether-pathfinder 1.4.1
		cloth-config: Cloth Config v13 13.0.121
			cloth-basic-math: cloth-basic-math 0.6.1
		fabric-api: Fabric API 0.96.11+1.20.4
			fabric-api-base: Fabric API Base 0.4.36+78d798af4f
			fabric-api-lookup-api-v1: Fabric API Lookup API (v1) 1.6.49+82b1bb3e4f
			fabric-biome-api-v1: Fabric Biome API (v1) 13.0.16+78d798af4f
			fabric-block-api-v1: Fabric Block API (v1) 1.0.16+3e2216cb4f
			fabric-block-view-api-v2: Fabric BlockView API (v2) 1.0.4+78d798af4f
			fabric-blockrenderlayer-v1: Fabric BlockRenderLayer Registration (v1) 1.1.46+78d798af4f
			fabric-client-tags-api-v1: Fabric Client Tags 1.1.7+78d798af4f
			fabric-command-api-v1: Fabric Command API (v1) 1.2.41+f71b366f4f
			fabric-command-api-v2: Fabric Command API (v2) 2.2.20+78d798af4f
			fabric-commands-v0: Fabric Commands (v0) 0.2.58+df3654b34f
			fabric-containers-v0: Fabric Containers (v0) 0.1.86+df3654b34f
			fabric-content-registries-v0: Fabric Content Registries (v0) 5.0.15+78d798af4f
			fabric-convention-tags-v1: Fabric Convention Tags 1.5.10+78d798af4f
			fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.2.23+78d798af4f
			fabric-data-attachment-api-v1: Fabric Data Attachment API (v1) 1.1.4+b90db5744f
			fabric-data-generation-api-v1: Fabric Data Generation API (v1) 13.2.4+5c0133444f
			fabric-dimensions-v1: Fabric Dimensions API (v1) 2.1.61+78d798af4f
			fabric-entity-events-v1: Fabric Entity Events (v1) 1.6.1+09fc25014f
			fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.7.1+389931eb4f
			fabric-events-lifecycle-v0: Fabric Events Lifecycle (v0) 0.2.74+df3654b34f
			fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.46+78d798af4f
			fabric-item-api-v1: Fabric Item API (v1) 2.2.0+d6f2b0844f
			fabric-item-group-api-v1: Fabric Item Group API (v1) 4.0.26+58f8c0124f
			fabric-key-binding-api-v1: Fabric Key Binding API (v1) 1.0.41+78d798af4f
			fabric-keybindings-v0: Fabric Key Bindings (v0) 0.2.39+df3654b34f
			fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 2.3.0+a67ffb5d4f
			fabric-loot-api-v2: Fabric Loot API (v2) 2.1.9+78d798af4f
			fabric-message-api-v1: Fabric Message API (v1) 6.0.5+78d798af4f
			fabric-mining-level-api-v1: Fabric Mining Level API (v1) 2.1.65+78d798af4f
			fabric-model-loading-api-v1: Fabric Model Loading API (v1) 1.0.8+78d798af4f
			fabric-models-v0: Fabric Models (v0) 0.4.7+9386d8a74f
			fabric-networking-api-v1: Fabric Networking API (v1) 3.1.7+2e5ac5484f
			fabric-object-builder-api-v1: Fabric Object Builder API (v1) 13.0.14+080016e44f
			fabric-particles-v1: Fabric Particles (v1) 1.1.7+78d798af4f
			fabric-recipe-api-v1: Fabric Recipe API (v1) 2.0.20+78d798af4f
			fabric-registry-sync-v0: Fabric Registry Sync (v0) 4.0.19+58f8c0124f
			fabric-renderer-api-v1: Fabric Renderer API (v1) 3.2.4+78d798af4f
			fabric-renderer-indigo: Fabric Renderer - Indigo 1.5.4+78d798af4f
			fabric-renderer-registries-v1: Fabric Renderer Registries (v1) 3.2.53+df3654b34f
			fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.3.42+73761d2e4f
			fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 3.1.1+e761c6694f
			fabric-rendering-v0: Fabric Rendering (v0) 1.1.56+df3654b34f
			fabric-rendering-v1: Fabric Rendering (v1) 3.2.0+6fd945a04f
			fabric-resource-conditions-api-v1: Fabric Resource Conditions API (v1) 2.3.14+78d798af4f
			fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.11.20+df798a894f
			fabric-screen-api-v1: Fabric Screen API (v1) 2.0.17+78d798af4f
			fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.3.55+78d798af4f
			fabric-sound-api-v1: Fabric Sound API (v1) 1.0.17+78d798af4f
			fabric-transfer-api-v1: Fabric Transfer API (v1) 4.0.11+eb30349a4f
			fabric-transitive-access-wideners-v1: Fabric Transitive Access Wideners (v1) 5.0.14+78d798af4f
		fabric-language-kotlin: Fabric Language Kotlin 1.10.19+kotlin.1.9.23
			org_jetbrains_kotlin_kotlin-reflect: kotlin-reflect 1.9.23
			org_jetbrains_kotlin_kotlin-stdlib: kotlin-stdlib 1.9.23
			org_jetbrains_kotlin_kotlin-stdlib-jdk7: kotlin-stdlib-jdk7 1.9.23
			org_jetbrains_kotlin_kotlin-stdlib-jdk8: kotlin-stdlib-jdk8 1.9.23
			org_jetbrains_kotlinx_atomicfu-jvm: atomicfu-jvm 0.23.2
			org_jetbrains_kotlinx_kotlinx-coroutines-core-jvm: kotlinx-coroutines-core-jvm 1.8.0
			org_jetbrains_kotlinx_kotlinx-coroutines-jdk8: kotlinx-coroutines-jdk8 1.8.0
			org_jetbrains_kotlinx_kotlinx-datetime-jvm: kotlinx-datetime-jvm 0.5.0
			org_jetbrains_kotlinx_kotlinx-serialization-cbor-jvm: kotlinx-serialization-cbor-jvm 1.6.3
			org_jetbrains_kotlinx_kotlinx-serialization-core-jvm: kotlinx-serialization-core-jvm 1.6.3
			org_jetbrains_kotlinx_kotlinx-serialization-json-jvm: kotlinx-serialization-json-jvm 1.6.3
		fabricloader: Fabric Loader 0.15.7
			mixinextras: MixinExtras 0.3.5
		forgeconfigapiport: Forge Config API Port 20.4.3
			com_electronwill_night-config_core: core 3.6.6
			com_electronwill_night-config_toml: toml 3.6.6
		java: OpenJDK 64-Bit Server VM 17
		litematica: Litematica 0.17.2
		magiclib: MagicLib 0.7.398+fe2125a-stable
			magiclib-1_20_4: MagicLib for 1.20.4 0.7.398+fe2125a-stable
		malilib: MaLiLib 0.18.1
		masa_gadget_mod: Masa Gadget 3.2.334+08c8f70-stable
			masa_gadget_mod-1_20_4: Masa Gadget for 1.20.4 3.2.334+08c8f70-stable
		minecraft: Minecraft 1.20.4
		minihud: MiniHUD 0.30.2
		modmenu: Mod Menu 9.1.0-beta.1
		shulkerboxtooltip: Shulker Box Tooltip 4.0.8+1.20.4
		tweakeroo: Tweakeroo 0.19.2
		worldedit: WorldEdit 7.3.0+6678-55745ad
		worldeditcui: WorldEditCUI 1.20.3+01
		worldtools: WorldTools 1.2.4
		wurst: Wurst Client v7.41.2-MC1.20.4
		xaerominimap: Xaero's Minimap 24.0.3
		xaeroworldmap: Xaero's World Map 1.38.1
	Launched Version: 1.20.4
	Backend library: LWJGL version 3.3.2-snapshot
	Backend API: NVIDIA GeForce GTX 1080/PCIe/SSE2 GL version 3.2.0 NVIDIA 550.54.14, NVIDIA Corporation
	Window size: 1920x1033
	GL Caps: Using framebuffer using OpenGL 3.2
	GL debug messages: 
	Using VBOs: Yes
	Is Modded: Definitely; Client brand changed to 'fabric'
	Universe: 400921fb54442d18
	Type: Client (map_client.txt)
	Graphics mode: fancy
	Render Distance: 12/12 chunks
	Resource Packs: fabric
	Current Language: en_us
	Locale: en_GB
	CPU: 8x Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
@tolland tolland added status:unconfirmed New issue. Needs triage. type:bug Something isn't working labels Apr 6, 2024
@tolland
Copy link
Author

tolland commented Apr 6, 2024

Thought I would keep some notes on what I see (trying to increase my understanding...)

https://github.com/Wurst-Imperium/Wurst7/blob/v7.41.2/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java#L307

seems like the exception is being caused when initializing the new ArrayList<>(red) from the Set<BlockPos> red, presumably the set is being updated by another thread at the same time.

  new ArrayList<>(red).stream().filter(Objects::nonNull)
  .map(pos -> new BlockPos(pos.getX() - region.x(), pos.getY(),
	  pos.getZ() - region.z()))
  .forEach(pos -> {
	  bufferBuilder
		  .vertex(pos.getX(), pos.getY() + 0.01, pos.getZ())
		  .color(1, 0, 0, 0.5F).next();
	  bufferBuilder.vertex(pos.getX() + 1, pos.getY() + 0.01,
		  pos.getZ() + 1).color(1, 0, 0, 0.5F).next();
	  bufferBuilder
		  .vertex(pos.getX() + 1, pos.getY() + 0.01, pos.getZ())
		  .color(1, 0, 0, 0.5F).next();
	  bufferBuilder
		  .vertex(pos.getX(), pos.getY() + 0.01, pos.getZ() + 1)
		  .color(1, 0, 0, 0.5F).next();
  });

so from the stack:

java.lang.ArrayIndexOutOfBoundsException: Index 133 out of bounds for length 133
	at java.base/java.util.HashMap.keysToArray(HashMap.java:950)
	at java.base/java.util.HashSet.toArray(HashSet.java:368)
	at java.base/java.util.ArrayList.<init>(ArrayList.java:181)
	at net.wurstclient.hacks.MobSpawnEspHack$ChunkScanner.compileBuffer(MobSpawnEspHack.java:307)
	at net.wurstclient.hacks.MobSpawnEspHack.onUpdate(MobSpawnEspHack.java:144)

Assuming that the problem is actually that the red HashSet is being updated when it tries to create the ArrayList from the set, then something else must be accessing it. looks like this should ensure that scan() is complete before allowing compileBuffer to run:

		List<ChunkScanner> sortedScanners = scanners.values().stream()
			.filter(s -> s.doneScanning).filter(s -> !s.doneCompiling).sorted(c)
			.limit(loadingSpeed.getValueI()).collect(Collectors.toList());

https://github.com/Wurst-Imperium/Wurst7/blob/v7.41.2/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java#L137-L139

scanning should be complete here:
https://github.com/Wurst-Imperium/Wurst7/blob/c4e22b94347374912a02ed6ccb8ee6e936e57d20/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java#L290C1-L290C24

I tried some debugging on that...
https://github.com/tolland/Wurst7/blob/e0ea1e5829e19eda81de8da481fef8341784cfca/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java#L308-L312

	if(!future.isDone() || !doneScanning)
	{
		System.out.println("Future done: " + future.isDone());
		System.out.println("scanner doneScanning: " + doneScanning);
	}

And I can see a bunch of logging:

[18:05:46] [ForkJoinPool.commonPool-worker-10/INFO]: [STDOUT]: Saved region successfully
[18:05:46] [pool-9-thread-2/INFO]: [STDOUT]: World save took 1294ms
[18:05:56] [Render thread/INFO]: [STDOUT]: Future done: false
[18:05:56] [Render thread/INFO]: [STDOUT]: scanner doneScanning: true

which only occurs if I am breaking lots of blocks at the time

@tolland
Copy link
Author

tolland commented Apr 7, 2024

so my guess is that onReceivedPacket is being called like so

image

and calling clear() on the hashset. So at the same time the other thread for onUpdate calls compileBuffer for that scanner and that goes into the array which was cleared (or is being cleared by the previous thread)

image

@tolland
Copy link
Author

tolland commented Apr 7, 2024

I've been testing some possible work arounds:

private final Set<BlockPos> red =
	Collections.synchronizedSet(new HashSet<>());
	ArrayList<BlockPos> syncedRed;
	synchronized(red)
	{
	 syncedRed = new ArrayList<>(red);
	}
        syncedRed.stream().filter(Objects::nonNull)
					.map(pos -> new BlockPos(pos.getX() - region.x(),
              ....

@JAXPLE
Copy link
Contributor

JAXPLE commented May 24, 2024

I use the same address
I think there's a problem because I reset it in another class?
I think it'll be solved if I merge it well with an existing instance after deep copying..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:unconfirmed New issue. Needs triage. type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants