Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-218112

SynchedEntityData is using locks incorrectly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 1.16.5, 21w08b
    • Fix Version/s: 1.17 Pre-release 1
    • Labels:
      None
    • Confirmation Status:
      Plausible
    • Category:
      Crash, Networking
    • Mojang Priority:
      Very Important

      Description

      The bug

      Inside the Entity SynchedEntityData (or also known as DataTracker) class it is trying to use read-write locks to synchronize the internal maps access. Only some methods do correctly use a try-finally block to correctly ensure that at the end of the Method the lock is back to unlocked.

      Especially noteworthy is the assignValues method, which is not using try-finally, and calls the assignValue method that has a throw IllegalStateException in case of incompatible data. So any time that exception is thrown, the lock of this SynchedEntityData is left in a locked state, potentially causing a deadlock/crash.

      Currently, this behavior can be seen on the official Minecraft partner server CubeCraft. At least when playing in 1.16.5, all arrows sent by their server contain invalid data and cause this bug to lock the SynchedEntityData of all arrows.

      java.lang.IllegalStateException: Invalid entity data item type for field 8 on entity bgc['Arrow'/16059, l='ClientLevel', x=0.21, y=8.52, z=14.79]: old=0(class java.lang.Byte), new=-1(class java.lang.Integer)
      

      I've also checked snapshot 21w08b, where this issue has not been resolved yet.

        Attachments

          Activity

            People

            Assignee:
            slicedlime [Mojang] slicedlime
            Reporter:
            tr7zw tr7zw
            Votes:
            6 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              CHK: