Memory leaks 竹部署将等待Grails没有Quartz作业

Memory leaks 竹部署将等待Grails没有Quartz作业,memory-leaks,tomcat6,quartz-scheduler,grails-2.0,bamboo,Memory Leaks,Tomcat6,Quartz Scheduler,Grails 2.0,Bamboo,我正在使用竹子构建、测试和部署对服务器的提交。然而,每隔一段时间,我就会在Tomcat端得到一个失败的部署。竹不知道发生了什么,所以当应用程序不能正常启动时,我必须运行一个手动构建 据我所知,这是由于运行Quartz任务。有没有一种方法可以安全地部署战争,但要等到所有的工作都完成了?在部署之前,最好先取消部署计划 我已经调出我的Catalina日志来强调这个问题: Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoa

我正在使用竹子构建、测试和部署对服务器的提交。然而,每隔一段时间,我就会在Tomcat端得到一个失败的部署。竹不知道发生了什么,所以当应用程序不能正常启动时,我必须运行一个手动构建

据我所知,这是由于运行Quartz任务。有没有一种方法可以安全地部署战争,但要等到所有的工作都完成了?在部署之前,最好先取消部署计划

我已经调出我的Catalina日志来强调这个问题:

Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-3] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-4] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-5] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-6] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-8] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-10] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [Thread-212] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:15 PM org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/emdb]
Sep 12, 2012 12:01:16 PM org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [....webapps\emdb\WEB-INF\lib] could not be completely deleted. The presence of the remaining files may cause problems
Sep 12, 2012 12:01:16 PM org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [....webapps\emdb\WEB-INF] could not be completely deleted. The presence of the remaining files may cause problems
Sep 12, 2012 12:01:16 PM org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [....webapps\emdb] could not be completely deleted. The presence of the remaining files may cause problems
Sep 12, 2012 12:01:16 PM org.apache.catalina.startup.ExpandWar delete
SEVERE: [....webapps\emdb] could not be completely deleted. The presence of the remaining files may cause problems
Sep 12, 2012 12:01:17 PM org.apache.catalina.startup.HostConfig deployWAR

您是对的,Quartz调度程序不会停止为运行作业而创建的线程(工作线程池)。当应用程序关闭时,您需要调用方法。我很惊讶GrailsQuartz插件没有为您做这件事

发生这种情况还有其他原因。您可能有一些正在运行的作业,而Quartz挂起等待它们完成(即使在调用适当的关机时)。Tomcat不耐烦,在中间杀死了整个东西。签出()
org.quartz.scheduler.interruptJobsOnShutdown
org.quartz.scheduler.interruptJobsOnShutdownWithWait
选项

请注意,这对您没有帮助,因为您没有关闭整个JVM,只是取消部署一个应用程序

此外,错误消息将
Thread-212
列为原因之一。这很可能是您的自定义线程(总是命名线程!),它也必须被中断

另见

如何命名线程?我在grails中有两个quartz作业,但我不知道如何命名它们。@johngitta:quartz为他的线程命名,例如
quartzScheduler\u Worker-N
。但我在你的应用程序中看到了
Thread-212
。它不是由您创建的,就是由某个库创建的。看看,成功!谢谢你,先生。这需要一些额外的挖掘,但在过去的5个小时里,在过去的15次部署中,测试都取得了成功。@johngitta:很高兴听到这个消息。你能进一步解释一下问题是什么以及你是如何解决的吗?第一个问题是石英配置没有创建,所以我添加了缺少的内容。然后将
waitForJobsToCompleteOnShutdown
标志设置为true。