New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX#4505] FileSizeFilter make memory leak #4507
Conversation
@@ -56,7 +57,7 @@ public class FileSizeFilter implements WebFilter { | |||
private final List<HttpMessageReader<?>> messageReaders; | |||
|
|||
public FileSizeFilter(final int fileMaxSize) { | |||
HandlerStrategies handlerStrategies = HandlerStrategies.builder().codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(fileMaxSize * BYTES_PER_MB)).build(); | |||
HandlerStrategies handlerStrategies = HandlerStrategies.builder().codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(-1)).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why modify -1 ?
})); | ||
}); | ||
}).doOnDiscard(DataBuffer.class, DataBufferUtils::release); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doOnDiscard---》doOnFinal?
Codecov Report
@@ Coverage Diff @@
## master #4507 +/- ##
============================================
+ Coverage 68.33% 68.42% +0.09%
- Complexity 7610 7614 +4
============================================
Files 1029 1029
Lines 29401 29403 +2
Branches 2659 2659
============================================
+ Hits 20090 20118 +28
+ Misses 7719 7694 -25
+ Partials 1592 1591 -1
... and 5 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Dear community
1、Corrected
maxInMemorySize
to- 1
to resolve theorg.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer
error.2、Finally, the DataBuffer object was released.
please review code.
Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true
.