记录jenkins因为缓存空间不足挂掉问题
前言:今天老大说让我写个jenkins挂掉自动拉起的脚本,然后说jenkins挂了好多次了,让我找找原因,当时想自动拉起脚本不能根本上解决问题,我就去看tomcat日志,因为jenkins是在tomcat下启动的,然后过滤查询catalina.xxxx.log日志发现以下报错。
在网上查看相关问题,发现是因为资源添加到Web应用程序[/jenkins]的缓存中,在清除过期缓存条目后可用空间仍不足 - 请考虑增加缓存的最大空间
解决方法如下:
摘自tomcat官网的说明
1 | https: //tomcat.apache.org/tomcat-8.0-doc/config/resources.html |
下面一段文字是跟这个问题相关
1 2 | cacheMaxSize The maximum size of the static resource cache in kilobytes. If not specified, the default value is 10240 (10 megabytes). This value may be changed while the web application is running (e.g. via JMX). If the cache is using more memory than the new limit the cache will attempt to reduce in size over time to meet the new limit. If necessary, cacheObjectMaxSize will be reduced to ensure that it is no larger than cacheMaxSize/20. |
只要在$tocamt_home/conf/context.xml里增加资源最大可缓存的大小就行了,大小可按自己的需要定义
1 2 3 | <?xml version= "1.0" encoding= "UTF-8" ?> <Resources cachingAllowed= "true" cacheMaxSize= "102400" /> </Context> |
然后重启tomcat即可,发现重启之后就没有报错了,暂时也没发现挂掉了。
总结: 学会看日志能解决很多问题,出问题不用慌。每天进步一点点啦
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通