Skip to content

Commit

Permalink
fix JENKINS-31768 dead lock while removing computer
Browse files Browse the repository at this point in the history
(cherry picked from commit c7fd90a)
  • Loading branch information
fengxx authored and olivergondza committed Nov 3, 2016
1 parent 4421d1b commit 1875144
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 @@ -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;

Expand Down

0 comments on commit 1875144

Please sign in to comment.