From 6973055ee1cfe4560961e003e7caf3953cbb8ce9 Mon Sep 17 00:00:00 2001 From: mbax Date: Sun, 15 Feb 2026 12:42:01 -0500 Subject: [PATCH] Catch attribute modification off the main thread. The clear() call in refreshDirtyAttributes can lead to server crashes if called asynchronously. This async catcher addition should highlight which plugins cause the trouble. --- .../features/0005-Entity-Activation-Range-2.0.patch | 4 ++-- .../net/minecraft/world/entity/LivingEntity.java.patch | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/paper-server/patches/features/0005-Entity-Activation-Range-2.0.patch b/paper-server/patches/features/0005-Entity-Activation-Range-2.0.patch index 6110e917e631..4a4b786f63cd 100644 --- a/paper-server/patches/features/0005-Entity-Activation-Range-2.0.patch +++ b/paper-server/patches/features/0005-Entity-Activation-Range-2.0.patch @@ -521,10 +521,10 @@ index 34ef15867759ebc7296256a6d5ec286eb3a5f895..d3d97b0b6ff6312f1deb0bb8b1beef8b movement = this.maybeBackOffFromEdge(movement, type); Vec3 vec3 = this.collide(movement); diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 5b6020de0848458f5576113e690b5a6435f35d05..6f49b5e5888a6296b929e465a5ef87dc49bd4516 100644 +index c13c51bcdf8e9db62ac818f78c2fa77c5f36a253..3211231fd71820f832b408eb9065a75bb2199154 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -3330,6 +3330,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3331,6 +3331,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin protected void playAttackSound() { } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch index e763a6ef5cad..30521abe6728 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch @@ -445,6 +445,14 @@ if (mobEffectInstance != null) { this.onEffectsRemoved(List.of(mobEffectInstance)); return true; +@@ -1101,6 +_,7 @@ + } + + private void refreshDirtyAttributes() { ++ org.spigotmc.AsyncCatcher.catchOp("attribute update"); // Paper + Set attributesToUpdate = this.getAttributes().getAttributesToUpdate(); + + for (AttributeInstance attributeInstance : attributesToUpdate) { @@ -1134,17 +_,62 @@ }