mojira.dev
MC-218112

SynchedEntityData is using locks incorrectly

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.

Comments 1

⚠️ Please do not mark Unreleased Versions as affected. You don't have access to them yet.

-- I am a bot. This action was performed automatically! Please report any issues on Discord or Reddit

tr7zw

slicedlime

Plausible

Very Important

Crash, Networking

1.16.5, 21w08b

1.17 Pre-release 1

Retrieved