Create

Create

86M Downloads

Crash in Toolbox GUI with multiple players connected with same slot.

leedagee opened this issue ยท 2 comments

commented

Mod Version:
0.3.2f (1.16.5 2db2892)
Can also be reproduced in the latest 0.4 8101f19 with Minecraft 1.18

Environment: Arch Linux, X11, AMD RX 550, Create Above&Beyond pack (java 8) or 1.16.5 (with only Flywheel and Create installed) or ForgeGradle (dev environment in 1.18 with java 17)

Steps to Produce:

  1. Start a server (integrated or dedicated) with two players connected.
  2. Place a toolbox and fill items in first slot of toolbox.
  3. For each players, equip a toolbox slot with hotbar.
  4. Open toolbox gui (one of the players, but not sure which one), press q on equipped hotbar.
  5. Server crash.

Expected Behavior:
Unequip the slot without crashing

Crash Report:
https://gist.github.com/leedagee/00a8fa8a32a77a98797f24e4c48e6980

This crashes Create A&B modpack with dedicated server and ONLY one player connected (me), originally. The crash report is identical with crash report posted above. After some code digging, I found the above steps to reproduce. The steps to produce with only one player connected is not available yet (maybe some randomness or whatever).

In ToolboxTileEntity#tickPlayers's for loop iterating PlayerEntity and hotbar slot index (L120) for a toolbox slot, if gui is open and item count in player's hotbar is not the target count, ToolboxHandler#unequip is called, the WeakHashMap we are iterating is modified by ToolboxTileEntity#unequip with a Iterator instance of the entry set is present. If there is another player connecting the same slot in the toolbox, calling playerEntities.next() could throw a ConcurrentModificationException. We should remove the entry using the iterator, instead of directly accessing the map whose entry set iterator will be used later.

commented

This issue has been marked as stale because it has been inactive for 3 weeks. It will be closed if it remains inactive for another 3 weeks.

commented

This issue has been closed since it has been inactive for 3 weeks since it was marked as stale.