Skip to content

Commit 9529642

Browse files
Aias00847850277
andauthored
[fix] fix data buffer leak (#5988)
* [fix] fix data buffer leak * [fix] fix data buffer leak --------- Co-authored-by: zhengpeng <847850277@qq.com>
1 parent 6898a92 commit 9529642

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/support/ResponseDecorator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ public Mono<Void> writeWith(@NonNull final Publisher<? extends DataBuffer> body)
5252
return dataBufferMono.flatMap(dataBuffer -> {
5353
byte[] bytes = new byte[dataBuffer.readableByteCount()];
5454
dataBuffer.read(bytes);
55+
DataBufferUtils.release(dataBuffer);
5556
String bodyString = new String(bytes, StandardCharsets.UTF_8);
5657
final String convertStr = convert.apply(bodyString);
57-
return WebFluxResultUtils.result(this.exchange, convertStr);
58+
return WebFluxResultUtils.result(this.exchange, convertStr).doFinally(signalType -> DataBufferUtils.release(dataBuffer));
5859
});
5960
}
6061
}

0 commit comments

Comments
 (0)