Skip to content

Commit

Permalink
fix JENKINS-31768 dead lock while removing computer
Browse files Browse the repository at this point in the history
  • Loading branch information
fengxx committed Nov 28, 2015
1 parent 67a42ea commit c7fd90a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion core/src/main/java/hudson/model/Computer.java
Expand Up @@ -828,7 +828,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;

Expand Down

0 comments on commit c7fd90a

Please sign in to comment.