2013-07-28 77 views
3

停止響應我有使用Tomcat應用程序託管,並停止12-18hrs響應後,我可以是工作訪問其他應用程序,如Tomcat管理器即tomcat的過程,但我部署的應用程序停止響應。Web應用程序後12-18小時

我無法找到任何在日誌中,我可以直接得到某些原因確實顯著。

我使用的Struts2 + Spring + Hibernate的碧玉+ +的jQuery。而我的tomcat是7.0.32託管的mysql數據庫。

請讓我知道 - 怎麼知道究竟是什麼原因即調試出來以後如何解決它。

如果需要,我可以添加一些日誌,但不知道要添加哪些日誌,哪些不需要請求版主不要將此問題標記爲虛假或無法回答的問題,而是註釋掉,我將根據需要添加/更新問題。

我看過一些相關的問題,但他們比我真的不一樣。

在此先感謝。服務器被我停止並顯示以下簡要

INFO: Waiting for 200 instance(s) to be deallocated 
     Jul 28, 2013 8:27:15 PM org.apache.catalina.core.StandardWrapper unload 
     INFO: Waiting for 200 instance(s) to be deallocated 
     Jul 28, 2013 8:27:15 PM org.apache.catalina.core.StandardWrapper unload 
     INFO: Waiting for 1 instance(s) to be deallocated 
     Jul 28, 2013 8:27:16 PM org.apache.catalina.core.StandardWrapper unload 
     INFO: Waiting for 1 instance(s) to be deallocated 
     Jul 28, 2013 8:27:17 PM org.apache.catalina.core.StandardWrapper unload 
     INFO: Waiting for 1 instance(s) to be deallocated 
     Jul 28, 2013 8:27:17 PM org.apache.catalina.core.ApplicationContext log 
     INFO: Closing Spring root WebApplicationContext 
     Jul 28, 2013 8:27:17 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc 
     SEVERE: 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. 
     Jul 28, 2013 8:27:17 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 
     SEVERE: The web application [] 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. 
     Jul 28, 2013 8:27:17 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 
     SEVERE: The web application [] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. 
     Jul 28, 2013 8:27:17 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 
     SEVERE: The web application [] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] but has failed to stop it. This is very likely to create a memory leak. 
............. 



SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [[email protected]]) and a value of type [org.springframework.aop.framework.Cglib2AopProxy.CglibMethodInvocation] (value [ReflectiveMethodInvocation: public java.util.List com.cursive.eclinic.processor.DoctorProcessor.list(com.cursive.eclinic.DoctorCriteria) throws java.lang.Exception; target is of class [com.cursive.eclinic.processor.DoctorProcessor]]) 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. 
     Jul 28, 2013 8:27:18 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks 
     SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [[email protected]]) and a value of type [com.opensymphony.xwork2.ActionContext] (value [[email protected]]) 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. 
     Jul 28, 2013 8:27:18 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks 
     SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [[email protected]]) and a value of type [org.apache.struts2.dispatcher.Dispatcher] (value [[email protected]]) 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. 
     Jul 28, 2013 8:27:18 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks 
     SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [[email protected]]) and a value of type [org.springframework.aop.framework.Cglib2AopProxy.CglibMethodInvocation] (value [ReflectiveMethodInvocation: public java.util.List com.cursive.eclinic.processor.TimeSlotProcessor.list(com.cursive.eclinic.TimeSlotCriteria) throws java.lang.Exception; target is of class [com.cursive.eclinic.processor.TimeSlotProcessor]]) 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. 
     Jul 28, 2013 8:27:18 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks 
     SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [[email protected]]) and a value of type [com.opensymphony.xwork2.ActionContext] (value [[email protected]]) 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. 
     Jul 28, 2013 8:27:18 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks 
     SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [[email protected]]) and a value of type [org.apache.struts2.dispatcher.Dispatcher] (value [[email protected]]) 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. 
     Jul 28, 2013 8:27:18 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks 
     SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [[email protected]]) and a value of type [org.springframework.aop.framework.Cglib2AopProxy.CglibMethodInvocation] (value [ReflectiveMethodInvocation: public java.util.List com.cursive.eclinic.processor.HospitalDoctorProcessor.list(com.cursive.eclinic.HospitalDoctorCriteria) throws java.lang.Exception; target is of class [com.cursive.eclinic.processor.HospitalDoctorProcessor]]) 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. 
     Jul 28, 2013 8:27:18 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks 
     SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [[email protected]]) and a value of type [com.opensymphony.xwork2.ActionContext] (value [[email protected]]) 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. 
     Jul 28, 2013 8:27:18 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks 
     SEVERE: The web application [] created a ThreadLocal with key of ThreadLocal with key of type [java.lang.ThreadLocal] (value [[email protected]]) and a value of type [org.apache.struts2.dispatcher.Dispatcher] (value [[email protected]]) 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. 
     Jul 28, 2013 8:27:18 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks 
     SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [[email protected]]) and a value of type [org.springframework.aop.framework.Cglib2AopProxy.CglibMethodInvocation] (value [ReflectiveMethodInvocation: public java.util.List com.cursive.eclinic.processor.HospitalProcessor.list(com.cursive.eclinic.HospitalCriteria) throws java.lang.Exception; target is of class [com.cursive.eclinic.processor.HospitalProcessor]]) 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. 
     Jul 28, 2013 8:27:18 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks 



INFO: Illegal access: this web application instance has been stopped already. Could not load org.apache.log4j.spi.ThrowableInformation. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. 
     java.lang.IllegalStateException 
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1599) 
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558) 
      at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:154) 
      at org.apache.log4j.Category.forcedLog(Category.java:388) 
      at org.apache.log4j.Category.log(Category.java:853) 
      at com.mchange.v2.log.log4j.Log4jMLog$Log4jMLogger.log(Log4jMLog.java:161) 
      at com.mchange.v2.log.log4j.Log4jMLog$Log4jMLogger.log(Log4jMLog.java:173) 
      at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:629) 
      at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477) 
      at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525) 
      at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) 
      at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:78) 
      at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) 
      at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) 
      at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161) 
      at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1577) 
      at org.hibernate.loader.Loader.doQuery(Loader.java:696) 
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) 
      at org.hibernate.loader.Loader.doList(Loader.java:2232) 
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129) 
      at org.hibernate.loader.Loader.list(Loader.java:2124) 
      at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118) 
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1599) 
      at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306) 

編輯的內容--------

Tomcat管理服務器狀態顯示

下後,創建

catilina.out

"http-bio-80" Max threads: 200 Current thread count: 149 Current thread busy: 146 Max processing time: 1066526 ms Processing time: 26227.367 s Request count: 5364 Error count: 262 Bytes received: 0.00 MB Bytes sent: 127.51 MB 

這是內存狀態

JVM

Free memory: 36.16 MB Total memory: 362.78 MB Max memory: 494.93 MB 
Memory Pool Type Initial Total Maximum Used 
Eden Space Heap memory 68.31 MB 100.12 MB 136.50 MB 81.74 MB (59%) 
Survivor Space Heap memory 8.50 MB 12.50 MB 17.06 MB 12.50 MB (73%) 
Tenured Gen Heap memory 170.68 MB 250.16 MB 341.37 MB 232.37 MB (68%) 
Code Cache Non-heap memory 2.43 MB 11.12 MB 48.00 MB 10.99 MB (22%) 
Perm Gen Non-heap memory 20.75 MB 69.87 MB 82.00 MB 69.76 MB (85%) 

這是什麼意思?

我做了一個聰明的事情今天重新啓動Tomcat的前停止響應,並且得到了以下日誌?他們說什麼

Jul 30, 2013 8:37:32 PM org.apache.coyote.AbstractProtocol pause 
INFO: Pausing ProtocolHandler ["http-bio-80"] 
Jul 30, 2013 8:37:32 PM org.apache.coyote.AbstractProtocol pause 
INFO: Pausing ProtocolHandler ["http-bio-443"] 
Jul 30, 2013 8:37:32 PM org.apache.coyote.AbstractProtocol pause 
INFO: Pausing ProtocolHandler ["ajp-bio-8009"] 
Jul 30, 2013 8:37:32 PM org.apache.catalina.core.StandardService stopInternal 
INFO: Stopping service Catalina 
Jul 30, 2013 8:37:33 PM org.apache.catalina.core.ApplicationContext log 
INFO: Closing Spring root WebApplicationContext 
Jul 30, 2013 8:37:33 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc 
SEVERE: 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. 
Jul 30, 2013 8:37:33 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 
SEVERE: The web application [] 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. 
Jul 30, 2013 8:37:33 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 
SEVERE: The web application [] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. 
Jul 30, 2013 8:37:33 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 
SEVERE: The web application [] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] but has failed to stop it. This is very likely to create a memory leak. 
Jul 30, 2013 8:37:33 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 
SEVERE: The web application [] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] but has failed to stop it. This is very likely to create a memory leak. 
Jul 30, 2013 8:37:33 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 
SEVERE: The web application [] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] but has failed to stop it. This is very likely to create a memory leak. 
Jul 30, 2013 8:37:33 PM org.apache.catalina.core.ApplicationContext log 
INFO: Closing Spring root WebApplicationContext 
Jul 30, 2013 8:37:33 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc 
SEVERE: The web application [/eclinic] 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. 
Jul 30, 2013 8:37:33 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 
SEVERE: The web application [/eclinic] 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. 
Jul 30, 2013 8:37:33 PM org.apache.coyote.AbstractProtocol stop 
INFO: Stopping ProtocolHandler ["http-bio-80"] 
Jul 30, 2013 8:37:33 PM org.apache.coyote.AbstractProtocol stop 
INFO: Stopping ProtocolHandler ["http-bio-443"] 
Jul 30, 2013 8:37:33 PM org.apache.coyote.AbstractProtocol stop 
INFO: Stopping ProtocolHandler ["ajp-bio-8009"] 
+0

我現在看到我的應用程序沒有響應,在tomcat管理器中我看到 –

+0

我也遇到了同樣的問題,我使用Hadoop,Hbase和Jquery。任何想法? –

回答

0

你會發現更多有關文件「catalina.out的」錯誤(Tomcat的日誌) :

C:\program files\apache software foundation\apache-tomcat{ver}\logs\catalina.out 
2

這個問題可能是一個連接問題,而不是tomcat的問題。在使用休眠時,您也應該使用連接池。否則,有可能斷開與數據庫的連接並且連接在一段時間後無法建立。像C3P0這樣的實用程序可用於解決問題。也請在tomcat文件夾中檢查日誌中的「catalina.out」文件。

+0

我正在使用連接池和c3p0仍然面臨此問題。使用catinia.out日誌更新原始文章。 –

+0

重新啓動tomcat管理器上下文後它工作嗎? – pikrut

+0

是的。重新啓動tomcat後,它工作正常,並在12-18小時後再次停止響應。 –

1

雖然我不知道你的日誌的順序好像是你的應用程序是按以下順序失敗:

  • 一些的Hiberante查詢無法執行,並拋出一個異常
  • 例外的是不處理得當並且可能會使關鍵資源處於打開狀態(即,您有內存泄漏 - 可能不會關閉數據庫連接或休眠會話)。
  • 這會導致一些線程掛起(大多數似乎屬於第三方庫,但有些是由您的應用程序創建的嫌疑犯)。
  • Tomcat檢測到這些情況並試圖關閉相應的服務來試圖恢復服務器的穩定性並最終關閉應用程序。

如果你的源代碼檢查,如果所有的數據庫相關的代碼工作正常(即連接/會話中的finally塊封閉不管是什麼),檢查應用程序(如有)將安全關機創建的線程。

+0

謝謝。我會看看並回來。但無論如何,我可以添加日誌,因爲這種情況在18小時後重複,所以必須等待很長時間。 –