Skip to content
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

Memory Leak in WebFlux application handling HTTP Multipart #33094

Closed
bugs84 opened this issue Jun 25, 2024 · 0 comments
Closed

Memory Leak in WebFlux application handling HTTP Multipart #33094

bugs84 opened this issue Jun 25, 2024 · 0 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@bugs84
Copy link

bugs84 commented Jun 25, 2024

Version
spring-boot version 3.3.1
spring-webflux 6.1.10

Description
In one of our applications, we are facing OutOfMemory error.
We think, that it is connected with Webflux and the upload files using HTTP Multipart requests.

We managed to create a small project with the test, that is able to reproduce issue:
LEAK: ByteBuf.release() was not called before it's garbage-collected.

The project can be found here: https://github.com/bugs84/webflux-leak-02

Basically, there is a controller that accepts multipart and saves it into the files.

   @PostMapping("/upload-files10")
    fun uploadFileWithoutEntity(@RequestPart("files", required = false) filePartFlux: Flux<Part>): Mono<*> {
        return filePartFlux.collectList().flatMap { fileList: List<Part> ->
            Flux.fromIterable(fileList).flatMapSequential { file: Part ->
                val destination = Paths.get("generated_${fileNumber++}.file")
                DataBufferUtils.write(file.content(), destination).then(Mono.just("ok"))
            }.then(Mono.just("OK"))
        }
    }

If we run the test it should generate the mentioned LEAK: issue.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 25, 2024
@jhoeller jhoeller added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Jun 25, 2024
@poutsma poutsma self-assigned this Jun 25, 2024
@poutsma poutsma assigned rstoyanchev and unassigned poutsma Jul 3, 2024
@rstoyanchev rstoyanchev removed their assignment Jul 12, 2024
@simonbasle simonbasle self-assigned this Aug 1, 2024
@simonbasle simonbasle added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 1, 2024
@simonbasle simonbasle added this to the 6.1.12 milestone Aug 1, 2024
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) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

6 participants