This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.3
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.3 by this push:
     new e6d7aac74d Fix CtrlCHandler release ByteBuf twice (#14577)
e6d7aac74d is described below

commit e6d7aac74df36f4b6ae692688f21f2de0b40df9e
Author: Albumen Kevin <[email protected]>
AuthorDate: Mon Aug 26 14:30:30 2024 +0800

    Fix CtrlCHandler release ByteBuf twice (#14577)
---
 .../main/java/org/apache/dubbo/qos/server/handler/CtrlCHandler.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/handler/CtrlCHandler.java
 
b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/handler/CtrlCHandler.java
index 9a4a203a04..add29b94fa 100644
--- 
a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/handler/CtrlCHandler.java
+++ 
b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/server/handler/CtrlCHandler.java
@@ -23,6 +23,7 @@ import io.netty.buffer.Unpooled;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.SimpleChannelInboundHandler;
 import io.netty.util.CharsetUtil;
+import io.netty.util.ReferenceCountUtil;
 
 public class CtrlCHandler extends SimpleChannelInboundHandler<ByteBuf> {
     /**
@@ -41,6 +42,10 @@ public class CtrlCHandler extends 
SimpleChannelInboundHandler<ByteBuf> {
 
     private byte[] RESPONSE_SEQUENCE = new byte[] {(byte) 0xff, (byte) 0xfc, 
0x06};
 
+    public CtrlCHandler() {
+        super(false);
+    }
+
     @Override
     protected void channelRead0(ChannelHandlerContext ctx, ByteBuf buffer) 
throws Exception {
         // find ctrl+c
@@ -63,6 +68,7 @@ public class CtrlCHandler extends 
SimpleChannelInboundHandler<ByteBuf> {
                 ctx.writeAndFlush(Unpooled.wrappedBuffer(
                         (QosConstants.BR_STR + 
QosProcessHandler.PROMPT).getBytes(CharsetUtil.UTF_8)));
 
+                ReferenceCountUtil.release(buffer);
                 return;
             }
         }

Reply via email to