You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I observe not an entirely deterministic issue while uploading big multipart files. It does not occur for small files. This error appears in the server logs:
And these are the tests (full source code available here):
@SpringBootTestclassBigMultipartFileUploadTest {
privatestaticfinalintNUMBER_OF_RESOURCES = 30;
privateWebTestClientwebTestClient;
@BeforeEachvoidbefore(ApplicationContextapplicationContext) {
webTestClient = WebTestClient.bindToApplicationContext(applicationContext).build();
}
/** * This test passes all the time */@TestvoidshouldUploadSmallFile() {
// givenintresourceSize = 5_000;
varbody = buildMultiValueMap(resourceSize);
// expectsendPostRequest(body).isEqualTo(resourceSize * NUMBER_OF_RESOURCES);
}
/** * This test fails most of the time */@TestvoidshouldUploadBigFile() {
// givenintresourceSize = 5_000_000;
varbody = buildMultiValueMap(resourceSize);
// expectsendPostRequest(body).isEqualTo(resourceSize * NUMBER_OF_RESOURCES);
}
privateWebTestClient.BodySpec<Integer, ?> sendPostRequest(MultiValueMap<String, HttpEntity<?>> body) {
returnwebTestClient.post()
.uri("/files")
.contentType(MediaType.MULTIPART_FORM_DATA)
.body(BodyInserters.fromMultipartData(body))
.exchange()
.expectBody(Integer.class);
}
privateMultiValueMap<String, HttpEntity<?>> buildMultiValueMap(intresourceSize) {
MultipartBodyBuilderbuilder = newMultipartBodyBuilder();
for (inti = 0; i < NUMBER_OF_RESOURCES; i++) {
builder.part("item-" + i, newByteArrayResource(i, resourceSize));
}
returnbuilder.build();
}
privateByteArrayResourcenewByteArrayResource(intfileIndex, intresourceSize) {
returnnewByteArrayResource(RandomUtils.nextBytes(resourceSize)) {
@OverridepublicStringgetFilename() {
return"filename-" + fileIndex;
}
};
}
}
As you can see, the only difference between these two tests is the resourceSize.
The first test always works, and the second one doesn't work most of the time.
Interestingly, this problem does not occur in the Spring Boot version 2.3.12.RELEASE, so it looks like a regression.
The text was updated successfully, but these errors were encountered:
I don't want this to sound rude, but when could I expect someone to take care of this? If this cannot be resolved in the foreseeable future, we will have to schedule a downgrade, so I'd like to know what we should prepare for.
I observe not an entirely deterministic issue while uploading big multipart files. It does not occur for small files. This error appears in the server logs:
I created a minimal reproducible example to illustrate this issue.
This is the endpoint (full source code available here):
And these are the tests (full source code available here):
As you can see, the only difference between these two tests is the
resourceSize
.The first test always works, and the second one doesn't work most of the time.
Interestingly, this problem does not occur in the Spring Boot version 2.3.12.RELEASE, so it looks like a regression.
The text was updated successfully, but these errors were encountered: