After uprading from spring boot 2.3.0 to 2.3.1, our application in staging environment quickly reached linux maximum open files limit. Using lsof -i 6 -p <pid>
to check open file descriptors of the spring boot webflux application, there are lots this kind of open file descriptors:
java 898 ce-devel 2540u sock 0,8 0t0 27988 protocol: TCPv6
java 898 ce-devel 2541u sock 0,8 0t0 27989 protocol: TCPv6
java 898 ce-devel 2542u sock 0,8 0t0 27990 protocol: TCPv6
java 898 ce-devel 2543u sock 0,8 0t0 27991 protocol: TCPv6
java 898 ce-devel 2544u sock 0,8 0t0 27992 protocol: TCPv6
java 898 ce-devel 2545u sock 0,8 0t0 27993 protocol: TCPv6
java 898 ce-devel 2546u sock 0,8 0t0 27994 protocol: TCPv6
java 898 ce-devel 2547u sock 0,8 0t0 27995 protocol: TCPv6
java 898 ce-devel 2548u sock 0,8 0t0 27996 protocol: TCPv6
java 898 ce-devel 2549u sock 0,8 0t0 27997 protocol: TCPv6
java 898 ce-devel 2550u sock 0,8 0t0 27998 protocol: TCPv6
java 898 ce-devel 2551u sock 0,8 0t0 27999 protocol: TCPv6
java 898 ce-devel 2552u sock 0,8 0t0 28000 protocol: TCPv6
java 898 ce-devel 2553u sock 0,8 0t0 28001 protocol: TCPv6
java 898 ce-devel 2554u sock 0,8 0t0 28002 protocol: TCPv6
java 898 ce-devel 2555u sock 0,8 0t0 28003 protocol: TCPv6
java 898 ce-devel 2556u sock 0,8 0t0 28004 protocol: TCPv6
java 898 ce-devel 2557u sock 0,8 0t0 28005 protocol: TCPv6
java 898 ce-devel 2558u sock 0,8 0t0 28006 protocol: TCPv6
java 898 ce-devel 2559u sock 0,8 0t0 28007 protocol: TCPv6
java 898 ce-devel 2560u sock 0,8 0t0 28008 protocol: TCPv6
java 898 ce-devel 2561u sock 0,8 0t0 28009 protocol: TCPv6
java 898 ce-devel 2562u sock 0,8 0t0 28010 protocol: TCPv6
and the number keep increasing. Downgrading to spring boot 2.3.0 solved the problem.
This problem only occurs resides in applications where reactor netty based webclients are used with no special configuration:
@LoadBalanced
@Bean
public WebClient.Builder loadBalancedWebClient() {
return WebClient.builder();
}
@Primary
@Bean
public WebClient.Builder webClient() {
return WebClient.builder();
}
So I think the problem exists in WebClient.Builder
or reactor netty
. I think this is really a serious issue and stopped us from upgrading to newer version.
For your reference : https://serverfault.com/questions/1000338/in-lsof-output-what-are-those-sock-lines
Comment From: bclozel
This is a duplicate of #25326 Thanks for your report!