Spring Boot Version: 2.3.1, when 2.3.0 has no problem
When using a sample Webclient
to retrive a remote restful API, this happens.
The test code:
@RestController
@Slf4j
public class WebClientController {
@Autowired
private WebClient.Builder webClientBuilder;
@PostMapping(value = "/wb")
public Mono<String> wbTest(@PathVariable(required = false) String action) {
return webClientBuilder.build().get().uri("http://remoteIP:remotePort/privaters/jwks/pub")
.retrieve()
.bodyToMono(String.class);
}
}
After a few requsts, using lsof -p XXX
to check, then shows scokets leaked!
java 10823 ircp 32u sock 0,7 0t0 154700740 protocol: TCP
java 10823 ircp 33u sock 0,7 0t0 154701211 protocol: TCP
java 10823 ircp 34u sock 0,7 0t0 154700776 protocol: TCP
java 10823 ircp 35u sock 0,7 0t0 154700777 protocol: TCP
java 10823 ircp 36u sock 0,7 0t0 154700778 protocol: TCP
java 10823 ircp 37u sock 0,7 0t0 154701301 protocol: TCP
java 10823 ircp 38u sock 0,7 0t0 154701304 protocol: TCP
java 10823 ircp 39u sock 0,7 0t0 154701307 protocol: TCP
java 10823 ircp 40u sock 0,7 0t0 154701837 protocol: TCP
Comment From: bclozel
I think this is a duplicate of spring-projects/spring-boot#22091 and spring-projects/spring-boot#21923 This was an issue in Reactor Netty. You can work around this problem by upgrading to Reactor Dysprosium-SR9 (or wait for spring-projects/spring-boot#21938 if you're using Spring Boot).
Thanks for your report!
Comment From: fanticat
@bclozel Thanks for your feedback,I have degrade the Spring Boot to V2.3.0 as temporary solution.