Skip to content

Commit

Permalink
Merge pull request #2440 from jglick/no-dead-executors
Browse files Browse the repository at this point in the history
Remove the concept of yanking dead executors
  • Loading branch information
jglick authored Jul 8, 2016
2 parents 7d868e5 + 0969e0a commit c528cdc
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 326 deletions.
3 changes: 0 additions & 3 deletions core/src/main/java/hudson/model/Computer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1039,9 +1039,6 @@ public void run() {
/**
* Returns true if any of the executors are {@linkplain Executor#isActive active}.
*
* Note that if an executor dies, we'll leave it in {@link #executors} until
* the administrator yanks it out, so that we can see why it died.
*
* @since 1.509
*/
protected boolean isAlive() {
Expand Down
36 changes: 7 additions & 29 deletions core/src/main/java/hudson/model/Executor.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ public class Executor extends Thread implements ModelObject {
@GuardedBy("lock")
private WorkUnit workUnit;

private Throwable causeOfDeath;

private boolean induceDeath;

@GuardedBy("lock")
private boolean started;

Expand Down Expand Up @@ -338,8 +334,6 @@ public void run() {
ACL.impersonate(ACL.SYSTEM);

try {
if (induceDeath) throw new ThreadDeath();

SubTask task;
// transition from idle to building.
// perform this state change as an atomic operation wrt other queue operations
Expand Down Expand Up @@ -434,7 +428,6 @@ public SubTask call() throws Exception {
LOGGER.log(FINE, getName()+" interrupted",e);
// die peacefully
} catch(Exception | Error e) {
causeOfDeath = e;
LOGGER.log(SEVERE, "Unexpected executor death", e);
} finally {
if (asynchronousExecution == null) {
Expand Down Expand Up @@ -466,9 +459,7 @@ private void finish2() {
for (RuntimeException e1 : owner.getTerminatedBy()) {
LOGGER.log(Level.FINE, String.format("%s termination trace", getName()), e1);
}
if (causeOfDeath == null) {// let this thread die and be replaced by a fresh unstarted instance
owner.removeExecutor(this);
}
owner.removeExecutor(this);
if (this instanceof OneOffExecutor) {
owner.remove((OneOffExecutor) this);
}
Expand All @@ -485,13 +476,6 @@ public void completedAsynchronous(@CheckForNull Throwable error) {
asynchronousExecution = null;
}

/**
* For testing only. Simulate a fatal unexpected failure.
*/
public void killHard() {
induceDeath = true;
}

/**
* Returns the current build this executor is running.
*
Expand Down Expand Up @@ -606,7 +590,7 @@ public boolean isBusy() {
* on-demand creation of executor threads. Callers should use
* this method instead of {@link #isAlive()}, which would be incorrect for
* non-started threads or running {@link AsynchronousExecution}.
* @return True if the executor is available for tasks
* @return true if the executor is available for tasks (usually true)
* @since 1.536
*/
public boolean isActive() {
Expand Down Expand Up @@ -660,13 +644,11 @@ public boolean isParking() {
}

/**
* If this thread dies unexpectedly, obtain the cause of the failure.
*
* @return null if the death is expected death or the thread {@link #isActive}.
* @since 1.142
* @deprecated no longer used
*/
@Deprecated
public @CheckForNull Throwable getCauseOfDeath() {
return causeOfDeath;
return null;
}

/**
Expand Down Expand Up @@ -870,14 +852,10 @@ public HttpResponse doStop() {
}

/**
* Throws away this executor and get a new one.
* @deprecated now a no-op
*/
@RequirePOST
@Deprecated
public HttpResponse doYank() {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
if (isActive())
throw new Failure("Can't yank a live executor");
owner.removeExecutor(this);
return HttpResponses.redirectViaContextPath("/");
}

Expand Down
58 changes: 0 additions & 58 deletions core/src/main/resources/hudson/model/Executor/causeOfDeath.jelly

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions core/src/main/resources/lib/hudson/executors.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ THE SOFTWARE.
${name}
</td>
<j:choose>
<j:when test="${!e.active}">
<td class="pane">
<a href="${rootURL}/${c.url}${url}/causeOfDeath">
<div class="error">${%Dead} (!)</div>
</a>
</td>
<td class="pane"/>
<td class="pane"/>
</j:when>
<j:when test="${e.idle}">
<td class="pane">
<j:choose>
Expand Down
Loading

0 comments on commit c528cdc

Please sign in to comment.