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

WebClient retrieve() does not handle Void.class as recommended [SPR-16636] #21177

Closed
spring-projects-issues opened this issue Mar 23, 2018 · 3 comments
Assignees
Labels
in: web type: bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Mar 23, 2018

Mykola Varahash opened SPR-16636 and commented

Currently, when user tries to consume response body content in the following way:

WebClient client = ...;
Mono<Void> result = client.get().retrieve().bodyToMono(Void.class);
result.block();

and a response actually contains body content, then the underlying http connection will not be closed and returned to connections pool.


Affects: 5.0.4

Issue Links:

Referenced from: commits 729d0d2, e28a995

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 23, 2018

Rossen Stoyanchev commented

What is this based on? Internally this calls consumeAndCancel which tries to consume, but raises and exception if any data comes in. The exception causes a cancellation signal upstream on the input Flux and that causes Reactor Netty to close the connection.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 23, 2018

Mykola Varahash commented

Please look at this DefaultWebClient.DefaultResponseSpec class
This code called when use "retrive()" function. The code which you pointer out called when use "exchange()" function.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 23, 2018

Rossen Stoyanchev commented

Ah, yes indeed, good catch!

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

No branches or pull requests

2 participants