Skip to content

[Bug] ConcurrentModificationException in AntiMapPlayerTracking on Folia #309

@uncaney

Description

@uncaney

Description

The AntiMapPlayerTracking module throws a ConcurrentModificationException when processing map packets. This appears to be a thread-safety issue where an ArrayList is being iterated while being modified concurrently.

Environment

  • Plugin version: AnarchyExploitFixes-Folia-2.7.12
  • Server software: Folia 1.21.8-DEV-5f95d90
  • PacketEvents version: 2.9.3

Stack Trace

[15:23:34] [Netty Epoll Server IO #9/WARN]: [com.github.retrooper.packetevents.PacketEventsAPI] PacketEvents caught an unhandled exception while calling your listener.
java.util.ConcurrentModificationException: null
        at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1096) ~[?:?]
        at java.base/java.util.ArrayList$Itr.next(ArrayList.java:1050) ~[?:?]
        at me.xginko.aef.modules.patches.AntiMapPlayerTracking.onPacketSend(AntiMapPlayerTracking.java:72) ~[AnarchyExploitFixes-Folia-2.7.12.jar:?]
        at com.github.retrooper.packetevents.event.PacketListener$1.onPacketSend(PacketListener.java:46) ~[packetevents-spigot-2.9.3.jar:?]
        ...

Expected Behavior

The module should handle concurrent access to collections safely without throwing exceptions.

Suggested Fix

Replace ArrayList with a thread-safe alternative (idk which one tho.)

Workaround found for me:

Disabling the module in config + disable gamerule map tracker.

anti-map-player-tracking:
  enabled: false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions