From 7fe2fc71e928e5980ae143acf51bda3bd21b394c Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Fri, 25 Dec 2020 17:03:01 -0500 Subject: [PATCH] Add some small debug for refcount issues with plugin messages. --- .../proxy/protocol/packet/PluginMessage.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PluginMessage.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PluginMessage.java index 5b9b3f136..ecd610629 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PluginMessage.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PluginMessage.java @@ -63,6 +63,12 @@ public class PluginMessage extends DeferredByteBufHolder implements MinecraftPac if (channel == null) { throw new IllegalStateException("Channel is not specified."); } + + if (refCnt() == 0) { + throw new IllegalStateException("Plugin message contents for " + this.channel + + " freed too many times."); + } + if (version.compareTo(ProtocolVersion.MINECRAFT_1_13) >= 0) { ProtocolUtils.writeString(buf, transformLegacyToModernChannel(this.channel)); } else {