Too many open files after upgrade to Spring Boot 2.2.8


最近新項目采用最新的 Spring Boot 2.2.8.RELEASE 版本,但是發布到部署環境后,提示 Too many open files 的錯誤。

錯誤日志

2020-07-03 11:09:54.469 [http-nio-9000-Acceptor] ERROR org.apache.tomcat.util.net.Acceptor - Socket accept failed
java.io.IOException: Too many open files
	at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
	at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:419)
	at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:247)
	at org.apache.tomcat.util.net.NioEndpoint.serverSocketAccept(NioEndpoint.java:469)
	at org.apache.tomcat.util.net.NioEndpoint.serverSocketAccept(NioEndpoint.java:71)
	at org.apache.tomcat.util.net.Acceptor.run(Acceptor.java:95)
	at java.lang.Thread.run(Thread.java:748)

經過查看stackoverflow、github上的相關問題,發現主要是Spring Boot 2.2.8.RELEASE依賴的reactor-netty版本號為0.9.8.RELEASE,這個版本會導致上述BUG。

查詢的相關資料

https://stackoverflow.com/questions/62655110/spring-boot-admin-too-many-open-files-in-system-error
https://github.com/spring-projects/spring-boot/issues/21934
https://github.com/spring-projects/spring-boot/issues/21923

按照官方的解決方式,采用在pom.xml升級新版本的方式

以下提供解決方案

<!-- bug fix Too many open files https://github.com/reactor/reactor-netty/issues/1152 -->
<dependency>
    <groupId>io.projectreactor.netty</groupId>
    <artifactId>reactor-netty</artifactId>
    <version>0.9.9.RELEASE</version>
</dependency>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM