--- title: Spring boot Too many open files错误 date: 2020-07-24 10:03:33 description: 记录升级Spring boot大版本后服务器宕机的问题 categories: [技术总结] tags: [Spring boot, Netty] --- ### 现象 前端同事突然告知集成环境连不上了,然后我连ssh测试一下,发现整个服务器都变得很慢了,监控显示有个dbus进程占用了100%的CPU。首先反应是被攻击了?最近就只是部署了一个新版本的webflux项目,查看了一下各种日志,发现到处都在报`Too many open files`。该服务器是测试服务器,里面用Docker部署了一堆容器:`Jenkins`,`MySQL`,`Redis`,`Spring boot admin`等等。此时Jenkins容器已经挂了,其他的虽然没挂但是也连不上了。猜测是Linux文件系统出了问题。 ### 原因 各种搜索后,发现这是`io.projectreactor.netty:reactor-netty:0.9.8.RELEASE`的一个bug,更新到`0.9.9.RELEASE`就可以修复了。 相关链接: [Too many open files after upgrade to Spring Boot 2.2.8 #21923](https://github.com/spring-projects/spring-boot/issues/21923) [Many File Open Issue : Spring Boot 2.3.0 -> Spring Boot 2.3.1 #21934](https://github.com/spring-projects/spring-boot/issues/21934) [Spring Boot uses version 0.9.8.RELEASE which contains a bug producing…](https://github.com/wayne-robinson/thule/commit/c13d2ce7c92f420612e658419bb1236f59cfd011) ### 解决 临时处理:先解决眼下的问题,kill掉dbus进程,然后重启服务器,做一下清理工作(redis日志多出来10个G撑爆了磁盘),然后重启每个容器,一切都正常了。后续还要关注一下Spring boot新版本这个问题的修复情况。 Spring boot 2.3.2将会修复这个bug,应该快了,再等等吧。OVER