Tomcat周期性自动关闭,高分求解

黎某人 2014-09-04 05:35:07
我在服务器上部署了Tomcat8,使用的默认JAVA_OPTS参数,但是每隔一段时间大概几十分钟或1,2个小时,就自动挂了,以下是日志自动关闭前的日志,麻烦看看是怎么回事,或者说存在什么样的可能,内部测试程序,还没部署到线上,就几个访问量,处理的都是小数据。

04-Sep-2014 17:27:17.278 INFO [Thread-6] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-20000"]
04-Sep-2014 17:27:17.280 INFO [Thread-6] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
2014-09-04 17:27:17 [org.springframework.web.context.support.XmlWebApplicationContext] - <Closing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Thu Sep 04 17:14:49 CST 2014]; parent: Root WebApplicationContext>
2014-09-04 17:27:17 [org.springframework.web.context.support.XmlWebApplicationContext] - <Closing Root WebApplicationContext: startup date [Thu Sep 04 17:14:47 CST 2014]; root of context hierarchy>
2014-09-04 17:27:17 [com.alibaba.druid.pool.DruidDataSource] - <{dataSource-1} closed>
04-Sep-2014 17:27:17.331 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesJdbc The web application [/] 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.
04-Sep-2014 17:27:17.332 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesJdbc The web application [/] registered the JDBC driver [com.alibaba.druid.mock.MockDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
04-Sep-2014 17:27:17.332 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesJdbc The web application [/] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
04-Sep-2014 17:27:17.333 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application [/] appears to have started a thread named [Memcached IO over {MemcachedConnection to 135be5bb1ee711e4.m.cnqdalicm9pub001.ocs.aliyuncs.com/10.157.212.8:11211}] but has failed to stop it. This is very likely to create a memory leak.

04-Sep-2014 17:27:17.334 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application [/] appears to have started a thread named [ForkJoinPool.commonPool-worker-1] but has failed to stop it. This is very likely to create a memory leak.
04-Sep-2014 17:27:17.334 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads Stack trace of thread "ForkJoinPool.commonPool-worker-1":
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.ForkJoinPool.awaitWork(ForkJoinPool.java:1756)
java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1696)
java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1644)
java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
04-Sep-2014 17:27:17.335 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application [/] appears to have started a thread named [transcoder-1-1] but has failed to stop it. This is very likely to create a memory leak.
04-Sep-2014 17:27:17.335 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads Stack trace of thread "transcoder-1-1":
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:403)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
04-Sep-2014 17:27:17.336 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application [/] appears to have started a thread named [pool-2-thread-1] but has failed to stop it. This is very likely to create a memory leak.
04-Sep-2014 17:27:17.336 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads Stack trace of thread "pool-2-thread-1":
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:403)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
04-Sep-2014 17:27:17.337 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application [/] appears to have started a thread named [pool-2-thread-2] but has failed to stop it. This is very likely to create a memory leak.
04-Sep-2014 17:27:17.337 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads Stack trace of thread "pool-2-thread-2":
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:403)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
04-Sep-2014 17:27:17.339 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application [/] appears to have started a thread named [pool-2-thread-3] but has failed to stop it. This is very likely to create a memory leak.
04-Sep-2014 17:27:17.340 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads Stack trace of thread "pool-2-thread-3":
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:403)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
04-Sep-2014 17:27:17.340 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application [/] appears to have started a thread named [pool-2-thread-4] but has failed to stop it. This is very likely to create a memory leak.
04-Sep-2014 17:27:17.344 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads Stack trace of thread "pool-2-thread-4":
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:403)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
04-Sep-2014 17:27:17.345 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application [/] appears to have started a thread named [pool-2-thread-5] but has failed to stop it. This is very likely to create a memory leak.
04-Sep-2014 17:27:17.345 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads Stack trace of thread "pool-2-thread-5":
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:403)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
04-Sep-2014 17:27:17.365 INFO [Thread-6] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-20000"]
04-Sep-2014 17:27:17.368 INFO [Thread-6] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-20000"]
...全文
6906 点赞 收藏 15
写回复
15 条回复
baidu_37847835 2017年03月10日
机器掉电后,开机后起Tomcat遇到一次这个问题,应该是memcached的问题,清理掉tomcat work下内容,重启memcached,再启动tomcat 就OK了。
回复 点赞
ranmannic 2016年03月12日
问题最后怎么解决的?也遇到了通用的问题,求解
回复 点赞
d12345b 2015年05月27日
请问楼主的问题解决了吗,现在遇到了同样问题
回复 点赞
海逸_2018 2014年09月05日
1) 确认下你连的数据库连接数是否占满了 2)确认你程序访问的数据库表是否被锁了,或者行锁,如果是,你程序频繁访问的话可能服务会挂掉
回复 点赞
huasuoworld 2014年09月05日
Stack trace of thread xxx,你项目有没有用线程,都关闭了没?
回复 点赞
晓风吹雾 2014年09月05日
1 log 大部分信息都是问题发生以后的信息。不好做分析 2 log的等级设置为trace和debug,便于分析 3 写一个批处理 使用pstack实时监视 各个线程的状态。每隔1s打印状态。便于分析。 综上 准备工作 做的越详细,这样便于发现问题。
回复 点赞
Magical茏 2014年09月05日
错误信息 the web application was stopped. To prevent a memory leak, 默认情况下,如果一个连接8小时都没有使用,mysql将会自动将其关闭.项目中用的是SSH框架.hibernate 3.0不会自动检查mysql链接是否有效.故当8小时没人访问,mysql则链接失效,若再有人访问,由于数据库链接已失效,tomcat为防止内存溢出,则也自动关闭. 楼主说 每隔一段时间大概几十分钟或1,2个小时,就自动挂了 我猜测可能是mysql 的wait_timeout设置 的时间被修改过,变的更短了 楼主 SHOW VARIABLES LIKE 'interactive_timeout' 看看mysql 的interactive_timeout 是不是默认的28800
回复 点赞
miracleliu 2014年09月05日
看看连接池,是不是没关闭
回复 点赞
niuzaiwenjie 2014年09月05日
but has failed to stop it. This is very likely to create a memory leak 但未能阻止它。这是创建一个内存泄漏很可能
回复 点赞
skgary 2014年09月05日
我觉得在这个之前是不是还有其他的错误导致的? 比如说有什么OutOfMemroy之类的??
回复 点赞
蜗牛- 2014年09月04日
黎某人 2014年09月04日
引用 3 楼 magi1201 的回复:
org.apache.catalina.loader.WebappClassLoader.clearReferencesJdbc The web application [/] 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. 这个错误之前论坛上出现过,是频繁热部署导致的 楼主的tomcat是开发环境吗?还是单的tomcat在跑,然后过段时间自己挂掉的?
热部署倒是没有,tomcat启动后什么都不干 一会就这样了
回复 点赞
蜗牛- 2014年09月04日
org.apache.catalina.loader.WebappClassLoader.clearReferencesJdbc The web application [/] 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. 这个错误之前论坛上出现过,是频繁热部署导致的 楼主的tomcat是开发环境吗?还是单的tomcat在跑,然后过段时间自己挂掉的?
回复 点赞
黎某人 2014年09月04日
引用 1 楼 whos2002110 的回复:
org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application [/] appears to have started a thread named [Memcached IO over {MemcachedConnection to 135be5bb1ee711e4.m.cnqdalicm9pub001.ocs.aliyuncs.com/10.157.212.8:11211}] but has failed to stop it. This is very likely to create a memory leak. 查缓存的链接用了没关掉?
自带的连接池
回复 点赞
whos2002110 2014年09月04日
org.apache.catalina.loader.WebappClassLoader.clearReferencesThreads The web application [/] appears to have started a thread named [Memcached IO over {MemcachedConnection to 135be5bb1ee711e4.m.cnqdalicm9pub001.ocs.aliyuncs.com/10.157.212.8:11211}] but has failed to stop it. This is very likely to create a memory leak. 查缓存的链接用了没关掉?
回复 点赞
发动态
发帖子
Web 开发
创建于2007-09-28

5.2w+

社区成员

34.1w+

社区内容

Java Web 开发
社区公告
暂无公告