On Wed, Mar 21, 2018 at 5:33 PM, Daniel Anechitoaie
<
danie...@gmail.com> wrote:
> java.lang.InterruptedException
> at hudson.model.Build$BuildExecution.build(Build.java:214)
So this is from
https://github.com/jenkinsci/jenkins/blob/3b5c715ae0d00ec3a38c63d8c9bf9de2a76b9e29/core/src/main/java/hudson/model/Build.java#L212-L214
I suspect that code is wrong—see below.
> But in Jenkins build log it just stops and nothing is displayed.
Not sure what would cause that. The stack trace implies that the
`InterruptedException` should be caught here:
https://github.com/jenkinsci/jenkins/blob/3b5c715ae0d00ec3a38c63d8c9bf9de2a76b9e29/core/src/main/java/hudson/model/Run.java#L1740-L1745
as apparently happened in your `Thread.sleep` test builder. Perhaps
the ZIP function is not interruptible, which is too bad, but then the
symptom should merely be that the ZIP proceeds to completion, and then
the build is shown as aborted in the normal way.
> If I cancel during the HTTP upload part there I get the java.nio.channels.ClosedByInterruptException
That would be consistent with my hypothesis that the thread interrupt
flag is not getting cleared. Check if this helps either or both of
your cases (ZIP and HTTP) without regressing the `sleep` case:
diff --git a/core/src/main/java/hudson/model/Build.java
b/core/src/main/java/hudson/model/Build.java
index 15aed23050..7f2fbbbc34 100644
--- a/core/src/main/java/hudson/model/Build.java
+++ b/core/src/main/java/hudson/model/Build.java
@@ -208,8 +208,7 @@ public abstract class Build <P extends
Project<P,B>,B extends Build<P,B>>
return false;
}
- Executor executor = getExecutor();
- if (executor != null && executor.isInterrupted()) {
+ if (Thread.interrupted()) {
// someone asked build interruption, let stop the
build before trying to run another build step
throw new InterruptedException();
}