Spring Boot Version: 2.3.1 or the dependency netty version: 4.1.50 When using spring cloud gateway, it happens. I think this bug's root cause is not Gateway, 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 requst, 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
I guess this bug should be caused by Spring Boot.
Comment From: wilkinsona
Thanks for the report. This looks like a duplicate of #21923.