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

WebFlux MultipartParser Blocks When Uploading Large Files, Causing Uploads to Occasionally Hang #34178

Open
guqing opened this issue Dec 30, 2024 · 1 comment
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on

Comments

@guqing
Copy link

guqing commented Dec 30, 2024

Description

When using WebFlux to upload large files, the upload process sometimes hangs before reaching the route's business logic. Specifically, the issue occurs during the client’s file upload to the org.springframework.http.codec.multipart.MultipartParser when writing to a temporary file, causing the upload to become stuck. This problem is intermittent but has a certain probability of occurring when uploading files of 200MB, between 2-3GB, and between 4-5GB.

Steps to Reproduce

  1. Set up a Spring Boot application using WebFlux to handle file upload requests.
  2. Upload a large file (e.g., 200MB, 2-3GB, or 4-5GB).
  3. Observe the upload process. Occasionally, the upload hangs before the file is fully transmitted to the server. At this point, the generated temporary file xxx.multipart is incomplete, and the request remains in a pending state without completing the upload.

Additional Resources

  • A minimal reproduction project has been provided that can replicate the aforementioned issue, However, it’s not guaranteed to happen every time; I tried a few times: large-file-upload.zip
  • Screen Recording Demonstration:
Kapture.2024-12-30.at.16.32.36.mp4

In the screen recording, I used an ISO file that I downloaded from the Manjaro official website: https://download.manjaro.org/gnome/24.2.1/manjaro-gnome-24.2.1-241216-linux612.iso

The file upload progress in the video is stuck at 68% and does not complete, regardless of how long you wait, with no error messages displayed

Expected Behavior

Large files should upload and be processed smoothly without hanging or blocking at any stage.

Actual Behavior

When uploading large files, the upload process sometimes hangs during the MultipartParser phase of writing to the temporary file, preventing the upload from completing.

Environment Information

  • Spring Boot Version: 3.4.1
  • Java Versions:
    • OpenJDK 17
    • Eclipse Temurin JDK 21.0.5
  • Operating Systems:
    • macOS
    • Linux
  • Other Relevant Dependencies: spring-boot-starter-webflux

Note: The issue has been tested and reproduced across all the above-mentioned systems and JDK versions.

Additional Information

This issue is not caused by business logic but by the framework’s handling of large file uploads and writing to temporary files, which leads to blocking. We hope the development team can investigate and resolve this issue to enhance the stability and reliability of large file uploads.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 30, 2024
@guqing
Copy link
Author

guqing commented Dec 30, 2024

Perhaps it would be more appropriate to raise this issue in the spring-framework project. I apologize for overlooking this. Could the developers please transfer this issue to the spring-framework repository?🤪

@snicoll snicoll transferred this issue from spring-projects/spring-boot Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Development

No branches or pull requests

2 participants