测试服务器上直接修改properties文件导致OOM的问题
来源:互联网 发布:linux 查看数据包 编辑:程序博客网 时间:2024/06/09 16:34
场景:测试服务器上,在未停止tomcat的情况下直接修改了配置文件(properties文件),稍后再有请求进来时(该请求会使用到properties文件中的属性),引发了OOMtomcat7.0.50配置文件:conf/server.xml中:<Context docBase="advertise-war" path="/advertise-war" reloadable="true" />path:访问该Web应用的URL入口reloadable:tomcat在运行时会监控 WEB-INF/classes 和 WEB-INF/lib目录下的class文件,如果监测到有class文件被更新的,tomcat会自动重新加载(先卸载,再部署)Web应用。分析:1)在卸载的过程中,(大概是由于文件被修改后)程序可能出错,导致原来的web应用卸载失败,从而导致原来的web应用仍然存在于Tomcat的缓存之中。2)虽然卸载失败,但是tomcat仍然会部署修改后的web应用。3)从而导致:tomcat在重新部署web应用时,由于无法删除已有的缓存,故可能会出现内存溢出的异常。建议:1)将reloadable属性设为false。2)将需要经常修改的配置文件(properties文件等)的配置信息持久化到数据库中。即:获取配置信息的策略由 配置文件的形式 改为 从数据库中获取(如果频繁使用,则放到缓存中)。之后进行本地测试时,部分日志的截取:
注:虽然没有报OOM,但是从日志可以推断出:如果重启前,正在执行的线程比较多的话,则在重启的过程中很可能报OOM。
7:39:42 下午 org.apache.catalina.core.StandardContext reload
信息: Reloading Context with name [/landpage-***-war] has started
7:39:42 下午 org.apache.catalina.core.StandardWrapper unload
信息: Waiting for 1 instance(s) to be deallocated for Servlet [advertise-landpage]
7:39:43 下午 org.apache.catalina.core.ApplicationContext log
信息: Destroying Spring FrameworkServlet 'advertise-landpage'
7:39:43 下午 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
7:39:43 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
警告: The web application [landpage-***-war] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
7:39:43 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
警告: The web application [landpage-***-war] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(Unknown Source)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:40)
7:39:43 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
警告: The web application [landpage-***-war] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.util.TimerThread.mainLoop(Unknown Source)
java.util.TimerThread.run(Unknown Source)
7:39:43 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
警告: The web application [landpage-***-war] appears to have started a thread named [MySQL Statement Cancellation Timer] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Unknown Source)
java.util.TimerThread.mainLoop(Unknown Source)
java.util.TimerThread.run(Unknown Source)
7:39:43 下午 org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
严重: The web application [landpage-***-war] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Locale context]) and a value of type [org.springframework.context.i18n.SimpleLocaleContext] (value [zh_CN]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
7:39:43 下午 org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
严重: The web application [landpage-***-war] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Request attributes]) and a value of type [org.springframework.web.context.request.ServletRequestAttributes] (value [org.apache.catalina.connector.Request@7c2addba]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
7:39:46 下午 org.apache.jasper.servlet.TldScanner scanJars
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
7:39:46 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
7:39:46 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
7:39:49 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring FrameworkServlet 'advertise-landpage'
7:39:50 下午 org.apache.catalina.core.StandardContext reload
信息: Reloading Context with name [/landpage-***-war] is completed
阅读全文
0 0
- 测试服务器上直接修改properties文件导致OOM的问题
- 一次在服务器上直接修改项目中*.properties文件导致的BUG
- Apache Pig DataBag spill 文件过多导致OOM问题
- 测试服务器上遇到的问题
- 安装下载工具,从服务器上直接下载对应的文件
- properties导致空指针的问题
- 修改my.cnf文件导致mysql启动不了的问题
- Android中解决图像解码导致的OOM问题
- Android中解决图像解码导致的OOM问题
- Android中解决图像解码导致的OOM问题
- 【Android问题及其解决】又见图片导致的OOM
- JVM的Perm区持续增长导致OOM问题记录
- 很好很好的select服务器程序,可直接运行,新手福利测试修改
- iOS 文件直接从别的工程拖过来导致的问题
- max_map_count超出导致的OOM
- Properties文件的乱码问题
- Properties文件找不到的问题
- 如何 修改 转码后的 properties 配置 文件
- mysql安装卡在Type and NetWorking,无法继续安装。
- leetcode解题方案--039-- CombinationSum
- 双线性插值
- 火狐浏览器所有历史版本下载地址
- 前端修改字体大小,google限制字体最小
- 测试服务器上直接修改properties文件导致OOM的问题
- Hibernate理解2:hibernate的运用理解
- 编写一个JFrame窗口
- 用easyui时遇到一对一 外键关联时 数据绑定
- Intent的详解
- Unity Shader 学习笔记(18)纹理动画、顶点动画、广告牌技术
- sleep与wait的区别
- Stenffensen加速迭代法
- 事件对象