Skip to content
Permalink
Browse files

fix JENKINS-31768 dead lock while removing computer

(cherry picked from commit c7fd90a)
  • Loading branch information
fengxx authored and olivergondza committed Nov 3, 2016
1 parent 4421d1b commit 1875144a072b9a4e388a7e49492bd24b95574b27
Showing with 13 additions and 1 deletion.
  1. +13 −1 core/src/main/java/hudson/model/Computer.java
@@ -862,7 +862,19 @@ protected void kill() {
protected void onRemoved(){
}

private synchronized void setNumExecutors(int n) {
/**
* Calling path, *means protected by Queue.withLock
*
* Computer.doConfigSubmit -> Computer.replaceBy ->Jenkins.setNodes* ->Computer.setNode
* AbstractCIBase.updateComputerList->Computer.inflictMortalWound*
* AbstractCIBase.updateComputerList->AbstractCIBase.updateComputer* ->Computer.setNode
* AbstractCIBase.updateComputerList->AbstractCIBase.killComputer->Computer.kill
* Computer.constructor->Computer.setNode
* Computer.kill is called after numExecutors set to zero(Computer.inflictMortalWound) so not need the Queue.lock
*
* @param number of executors
*/
private void setNumExecutors(int n) {
this.numExecutors = n;
final int diff = executors.size()-n;

0 comments on commit 1875144

Please sign in to comment.