多线程 – Hudson SCM轮询线程在轮询时挂起

我们将Hudson用于我们的连续构建环境.出于某种原因,SCM轮询的线程在一段时间后暂停了一些时间.我已经经历了很多设置,但似乎没有什么真正有效.如何解决这个问题,是否有一些脚本可以检测到这种情况能够重启哈德森?顺便说一句.重启哈德森是目前为我们解决这个问题的唯一方法.
最佳答案
这类似于bug 5413,应该从2010年底开始以HUDSON 5977(Hudson 1.380,或现在的Jenkins)解决.

你在那些线程some way to kill any thread stuck on the polling step

very primitive (I’m too lazy to develop something better as this is not very important issue) Groovy script is bellow.
It could happened that it will kill also SCM polling which are not stuck, but we run this script automatically only once a day so it doesn’t cause any troubles for us.
You can improve it e.g. by saving ids and names of SCM polling threads, check once again after some time and kill only threads which ids are on the list from previous check.

Thread.getAllStackTraces().keySet().each(){ item ->
  if( item.getName().contains("SCM polling") && 
      item.getName().contains("waiting for hudson.remoting")){ 
     println "Interrupting thread " + item.getId() item.interrupt() 
  }
}

转载注明原文:多线程 – Hudson SCM轮询线程在轮询时挂起 - 代码日志