-
Notifications
You must be signed in to change notification settings - Fork 37.7k
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
DataBufferUtils#join may release a DataBuffer more than necessary #26060
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Comments
rstoyanchev
added
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: bug
A general bug
labels
Nov 10, 2020
rstoyanchev
added
the
for: backport-to-5.2.x
Marks an issue as a candidate for backport to 5.2.x
label
Nov 10, 2020
spring-projects-issues
added
status: backported
An issue that has been backported to maintenance branches
and removed
for: backport-to-5.2.x
Marks an issue as a candidate for backport to 5.2.x
labels
Nov 10, 2020
rstoyanchev
added a commit
that referenced
this issue
Nov 10, 2020
Will |
when i download large file: return webClient
.get()
.uri(location)
.retrieve()
.bodyToFlux(DataBuffer.class)
.as(dataStream -> {
Path filePath = file.toPath();
log.debug("download protocol file {} to {}", location, file.getAbsolutePath());
try {
@SuppressWarnings("all")
AsynchronousFileChannel asynchronousFileChannel = AsynchronousFileChannel.open(filePath, CREATE, WRITE);
return DataBufferUtils
.write(dataStream, asynchronousFileChannel)
.doOnNext(DataBufferUtils.releaseConsumer())
.doAfterTerminate(() -> {
try {
asynchronousFileChannel.close();
} catch (IOException ignored) {
}
})
.then(Mono.just(file.getAbsolutePath()));
} catch (Exception e) {
throw new RuntimeException(e);
}
}) throws:
|
@zhou-hao Could you create a new issue with a sample project reproducing the problem? |
ok,try my best。
发自我的iPhone
…------------------ Original ------------------
From: Brian Clozel <notifications@github.com>
Date: Tue,Jan 19,2021 8:39 PM
To: spring-projects/spring-framework <spring-framework@noreply.github.com>
Cc: 老周 <zh.sqy@qq.com>, Mention <mention@noreply.github.com>
Subject: Re: [spring-projects/spring-framework] DataBufferUtils#join may release a DataBuffer more than necessary (#26060)
@zhou-hao Could you create a new issue with a sample project reproducing the problem?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
sorry,it's my bad~~ return DataBufferUtils
.write(dataStream, file.toPath(), CREATE, WRITE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
This is based on investigation under reactor/reactor-netty#1374.
In
DataBufferUtils#join
we use a custom List to collect buffers and check the total buffered size. When a buffer is added that hits the limit, an error is raised but this causes a double release of the current buffer because Reactor'sMonoCollect
discards both the item that was passed to the add method and all items in the list. That leads to a double decrease of the refCount when it should be decremented only once.The text was updated successfully, but these errors were encountered: