6 votes

L'application Web dans Tomcat 7 cesse de répondre après 12 à 18 heures.

J'ai une application hébergée à l'aide de tomcat et elle cesse de répondre après 12-18 heures, je peux accéder à d'autres applications comme le gestionnaire de tomcat, c'est-à-dire que le processus de tomcat fonctionne mais mon application déployée cesse de répondre.

Je n'ai rien trouvé de vraiment significatif dans les journaux que je peux obtenir directement pour une raison quelconque.

J'utilise struts2 + spring + hibernate + jasper + jquery. Et mon tomcat est 7.0.32 hébergé par une base de données mysql.

S'il vous plaît laissez-moi savoir - comment savoir ce qui est exactement la raison, c'est-à-dire le déboguer et plus tard comment le réparer.

Si nécessaire, je peux ajouter quelques journaux, mais je ne sais pas quels journaux ajouter et lesquels ne pas ajouter. Je demande donc aux modérateurs de ne pas marquer cette question comme fausse ou sans réponse, mais de la commenter et j'ajouterai/mettrai à jour la question si nécessaire.

J'ai lu quelques questions connexes, mais elles sont vraiment différentes des miennes.

Merci d'avance.

catilina.out a été créé après que le serveur ait été arrêté par moi et montre en bref le contenu suivant

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 [java.lang.ThreadLocal@55cd6225]) 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 [java.lang.ThreadLocal@1ee69725]) and a value of type [com.opensymphony.xwork2.ActionContext] (value [com.opensymphony.xwork2.ActionContext@56a2f846]) 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 [java.lang.ThreadLocal@2513679]) and a value of type [org.apache.struts2.dispatcher.Dispatcher] (value [org.apache.struts2.dispatcher.Dispatcher@21cf431f]) 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 [java.lang.ThreadLocal@55cd6225]) 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 [java.lang.ThreadLocal@1ee69725]) and a value of type [com.opensymphony.xwork2.ActionContext] (value [com.opensymphony.xwork2.ActionContext@6559e819]) 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 [java.lang.ThreadLocal@2513679]) and a value of type [org.apache.struts2.dispatcher.Dispatcher] (value [org.apache.struts2.dispatcher.Dispatcher@21cf431f]) 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 [java.lang.ThreadLocal@55cd6225]) 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 [java.lang.ThreadLocal@1ee69725]) and a value of type [com.opensymphony.xwork2.ActionContext] (value [com.opensymphony.xwork2.ActionContext@7194f54a]) 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 [java.lang.ThreadLocal@2513679]) and a value of type [org.apache.struts2.dispatcher.Dispatcher] (value [org.apache.struts2.dispatcher.Dispatcher@21cf431f]) 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 [java.lang.ThreadLocal@55cd6225]) 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)

Modifié --------

L'état du serveur Tomcat manager s'affiche sous

"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

Et voici l'état de la mémoire

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%)

Qu'est-ce que cela signifie ?

J'ai fait une chose intelligente aujourd'hui en redémarrant tomcat avant qu'il ne cesse de répondre et j'ai obtenu les logs suivants disent-ils quelque chose ?

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"]

4voto

Niju Points 487

Ce problème est probablement un problème de connexion et non un problème de tomcat. Si vous utilisez Hibernate, vous devez également utiliser la mise en commun des connexions, sinon vous risquez de vous déconnecter de la base de données et la connexion ne pourra pas être établie après un certain temps. Les jarres utilitaires comme C3P0 sont disponibles pour résoudre le problème. Veuillez également vérifier le fichier "catalina.out" dans le dossier de Tomcat pour le journal.

1voto

c.s. Points 3343

Bien que je ne sois pas sûr de l'ordre de vos journaux, il semble que votre application échoue dans l'ordre suivant :

  • Certaines requêtes hiberante ne s'exécutent pas et lèvent une exception.
  • Les exceptions ne sont pas traitées de manière appropriée et peuvent laisser des ressources critiques ouvertes (c'est-à-dire que vous avez des fuites de mémoire - peut-être ne ferme-t-il pas les connexions à la base de données ou les sessions hibernate).
  • Cela entraîne le blocage de certains threads (la plupart d'entre eux semblent appartenir à des bibliothèques tierces, mais certains sont des suspects créés par votre application).
  • Tomcat détecte ces conditions et essaie d'arrêter les services correspondants afin de rétablir la stabilité du serveur et finit par arrêter votre application.

Si vous disposez du code source, vérifiez si tout le code relatif à la base de données fonctionne correctement (c'est-à-dire que les connexions/sessions sont fermées dans un fichier de type finally ) et vérifie que les threads créés par l'application (s'il y en a) s'arrêteront de manière élégante.

-1voto

gui Points 170

Vous trouverez plus d'informations sur cette erreur dans le fichier "catalina.out" (journaux de Tomcat) :

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

Prograide.com

Prograide est une communauté de développeurs qui cherche à élargir la connaissance de la programmation au-delà de l'anglais.
Pour cela nous avons les plus grands doutes résolus en français et vous pouvez aussi poser vos propres questions ou résoudre celles des autres.

Powered by:

X