Утечки памяти в веб-сервисе Java с использованием Hibernate

1

Мое приложение работает нормально, но когда я останавливаю сервер, я получаю эти сообщения. Я не начинаю начинать нить, но я новичок в этих технологиях, и я не уверен, как они работают внутри страны.
Я использую C3p0 для создания пула соединений, и, возможно, есть утечка, потому что соединения не закрываются хорошо, но я не знаю, как правильно это сделать. Но кажется, что количество сообщений может быть больше проблем.
Пожалуйста, может кто-нибудь сказать мне, что все это значит и как я могу решить утечку памяти?
Извините, мой дефицитный английский. Спасибо вам всем.

...
Information: Closing Spring root WebApplicationContext
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/Consulta] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/Consulta] 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.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/Consulta] 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.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/Consulta] 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.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/Consulta] appears to have started a thread named [MultiThreadedHttpConnectionManager cleanup] but has failed to stop it. This is very likely to create a memory leak.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/Consulta] appears to have started a thread named [Timer-1] but has failed to stop it. This is very likely to create a memory leak.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/Consulta] 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.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/Consulta] 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.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/Consulta] 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.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/Consulta] appears to have started a thread named [Timer-2] but has failed to stop it. This is very likely to create a memory leak.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/Consulta] 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.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/Consulta] 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.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Severe: The web application [/Consulta] 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.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
Severe: The web application [/Consulta] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@aa7d6e]) and a value of type [org.apache.myfaces.config.RuntimeConfig] (value [org.apache.myfaces.config.RuntimeConfig@110d045]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
Severe: The web application [/Consulta] created a ThreadLocal with key of type [org.apache.xml.security.algorithms.SignatureAlgorithm$3] (value [org.apache.xml.security.algorithms.SignatureAlgorithm$3@10f67f1]) and a value of type [java.util.HashMap] (value [{http://vvv.w3.org/2000/09/xmldsig#rsa-sha1=Sun RSA private CRT key, 2048 bits
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
Severe: The web application [/Consulta] created a ThreadLocal with key of type [org.apache.xml.security.algorithms.MessageDigestAlgorithm$1] (value [org.apache.xml.security.algorithms.MessageDigestAlgorithm$1@711132]) and a value of type [java.util.HashMap] (value [{http://vvv.w3.org/2000/09/xmldsig#sha1=SHA-1 Message Digest from SUN, <initialized>
}]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
Severe: The web application [/Consulta] created a ThreadLocal with key of type [org.apache.myfaces.el.convert.VariableResolverToELResolver$1] (value [org.apache.myfaces.el.convert.VariableResolverToELResolver$1@1200ec5]) and a value of type [java.util.HashSet] (value [[]]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
Severe: The web application [/Consulta] created a ThreadLocal with key of type [org.apache.xml.security.utils.UnsyncBufferedOutputStream$1] (value [org.apache.xml.security.utils.UnsyncBufferedOutputStream$1@1a9e49c]) and a value of type [byte[]] (value [[B@dfebc1]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
Severe: The web application [/Consulta] created a ThreadLocal with key of type [org.apache.xml.security.utils.UnsyncByteArrayOutputStream$1] (value [org.apache.xml.security.utils.UnsyncByteArrayOutputStream$1@eedcc3]) and a value of type [byte[]] (value [[B@1dfadaa]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
Severe: The web application [/Consulta] created a ThreadLocal with key of type [org.apache.axis.utils.XMLUtils.ThreadLocalDocumentBuilder] (value [org.apache.axis.utils.XMLUtils$ThreadLocalDocumentBuilder@b1691a]) and a value of type [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl] (value [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl@16b470a]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
jun 12, 2014 2:32:09 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
Severe: The web application [/Consulta] created a ThreadLocal with key of type [org.apache.xml.security.algorithms.SignatureAlgorithm$1] (value [org.apache.xml.security.algorithms.SignatureAlgorithm$1@4e554]) and a value of type [java.util.HashMap] (value [{http://vvv.w3.org/2000/09/xmldsig#rsa-sha1=org.apache.xml.security.algorithms.implementations.SignatureBaseRSA$SignatureRSASHA1@16bf810}]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
jun 12, 2014 2:32:10 PM org.apache.coyote.http11.Http11Protocol destroy
Information: Parando Coyote HTTP/1.1 en puerto http-8080
jun 12, 2014 2:32:10 PM org.apache.coyote.http11.Http11Protocol destroy
Information: Parando Coyote HTTP/1.1 en puerto http-8443
Теги:
hibernate
memory-leaks

1 ответ

1
Лучший ответ

Для com.mchange.v2.async.ThreadPoolAsynchronousRunner см. Как com.mchange.v2.async.ThreadPoolAsynchronousRunner пул подключений при разгрузке контекста? , Ответ относится к Spring, но если вы не используете Spring, вы можете вызвать метод close() для com.mchange.v2.c3p0.ComboPooledDataSource в ServletContextListener.

Для Timer-0, если вышеприведенное решение недостаточно, см. Ошибка утечки памяти Catalina.out (особенно мой собственный ответ: qaru.site/questions/1870885/...).

  • 0
    Первая ссылка, кажется, идет правильно, но не дает много информации о том, как это сделать. У меня нет такого компонента для установки метода close. В любом случае, как я могу вызвать метод close для com.mchange.v2.c3p0.ComboPooledDataSource, если у меня есть ServletContextListener?
  • 0
    Вам потребуется экземпляр этого класса ComboPooledDataSource. Поскольку вы говорите, что у вас его нет, возможно, вы используете C3p0 по-другому; поэтому вам нужно проверить конфигурацию пула соединений и правильно расположить экземпляр пула, независимо от того, какой класс вы используете.
Показать ещё 1 комментарий

Ещё вопросы

Сообщество Overcoder
Наверх
Меню