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

xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 9529642022 [fix] fix data buffer leak (#5988)
9529642022 is described below

commit 9529642022c0ebf9f829631811f6798b8f5f3b9f
Author: aias00 <liuhon...@apache.org>
AuthorDate: Mon May 26 14:59:53 2025 +0800

    [fix] fix data buffer leak (#5988)
    
    * [fix] fix data buffer leak
    
    * [fix] fix data buffer leak
    
    ---------
    
    Co-authored-by: zhengpeng <847850...@qq.com>
---
 .../java/org/apache/shenyu/plugin/base/support/ResponseDecorator.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/support/ResponseDecorator.java
 
b/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/support/ResponseDecorator.java
index 5e1fc279c4..ae697c67f0 100644
--- 
a/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/support/ResponseDecorator.java
+++ 
b/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/support/ResponseDecorator.java
@@ -52,9 +52,10 @@ public class ResponseDecorator extends 
ServerHttpResponseDecorator {
         return dataBufferMono.flatMap(dataBuffer -> {
             byte[] bytes = new byte[dataBuffer.readableByteCount()];
             dataBuffer.read(bytes);
+            DataBufferUtils.release(dataBuffer);
             String bodyString = new String(bytes, StandardCharsets.UTF_8);
             final String convertStr = convert.apply(bodyString);
-            return WebFluxResultUtils.result(this.exchange, convertStr);
+            return WebFluxResultUtils.result(this.exchange, 
convertStr).doFinally(signalType -> DataBufferUtils.release(dataBuffer));
         });
     }
 }

Reply via email to