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

Load Balancer RequestInterceptor breaks large file uploads #1355

Open
ZIRAKrezovic opened this issue May 23, 2024 · 2 comments
Open

Load Balancer RequestInterceptor breaks large file uploads #1355

ZIRAKrezovic opened this issue May 23, 2024 · 2 comments

Comments

@ZIRAKrezovic
Copy link

ZIRAKrezovic commented May 23, 2024

Describe the bug

This is basically present in anything that implements a ClientRequestInterceptor. See the original bug report for Spring Framework, along with reproducer that uses spring-cloud-starter-loadbalancer and SimpleLoadBalancer.

As it turns out, adding a ClientRequestInterceptor to a RestClient or RestTemplate results in it being wrapped in "Buffering" factory rather than "Streaming" factory, effectively breaking the streaming functionality required for large file upload. This makes usage of load balancer client unsuitable for transferring large files between microservices that communicate via load balancer addresses.

Spring framework developer has responded that they have no plan to fix this or provide a solution, as the ClientRequestInterceptor contract is fixed.

Is there an alternative for spring cloud loadbalancer implementation to implement something other than ClientRequestInterceptor and achieve the same functionality?

spring-projects/spring-framework#32879
https://github.com/ZIRAKrezovic/spring-multipart-reproducer

Sample
If possible, please provide a test case or sample application that reproduces
the problem. This makes it much easier for us to diagnose the problem and to verify that
we have fixed it.

@OlgaMaciaszek
Copy link
Collaborator

OlgaMaciaszek commented Jun 25, 2024

@ZIRAKrezovic - yes, it's there; you can use a WebClient instance created with @LoadBalanced WebClient.Builder to achieve this. You can also use it as the base of client for Spring Interface Clients if you do not want to work directly with the reactive API.

@ZIRAKrezovic
Copy link
Author

Yes, I personally use web client, but sadly not everybody wants webflux as a dependency in webmvc application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants