--- a/net/minecraft/network/Varint21FrameDecoder.java
+++ b/net/minecraft/network/Varint21FrameDecoder.java
@@ -41,6 +_,12 @@
 
     @Override
     protected void decode(ChannelHandlerContext context, ByteBuf in, List<Object> out) {
+        // Paper start - Perf: Optimize exception handling; if channel is not active just discard the packet
+        if (!context.channel().isActive()) {
+            in.skipBytes(in.readableBytes());
+            return;
+        }
+        // Paper end - Perf: Optimize exception handling
         in.markReaderIndex();
         this.helperBuf.clear();
         if (!copyVarint(in, this.helperBuf)) {
