*>  Perhaps the ZIP function is not interruptible,  *
I think so too.

*> 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. *
Which is totally fine. I zip things in a loop so even if it can't be 
interrupted right away but it will stop the next loop iteration from 
happening is totally fine.


*> Check if this helps either or both of *
*> your cases (ZIP and HTTP) without regressing the `sleep` case: *
Give me some time to figure out how to compile Jenkins with this patch and 
then run my plugin in it and I'll come back with feedback.


Some other things that I noticed while doing all kind of tests is that:
The problem reported in this thread happens when I use:

---
workspace.act(new DeployCallable(...
...
private static class DeployCallable extends MasterToSlaveFileCallable<Void> 
{..
---

if I use

---
launcher.getChannel().call(new DeployCallable(...
...
private static class DeployCallable extends MasterToSlaveCallable<Void, 
IOException> {
---

then it's not possible to interrupt at all. If I click cancel the full 
build step runs and only at the end the build is marked as interrupted. 
So it kind of seems that only MasterToSlave*File*Callable supports being 
interrupted while MasterToSlaveCallable it does not.

But this is a different issue, so I just brought it up as a FYI. I'll run 
the tests with your patch and MasterToSlaveFileCallable




BTW thank you so much for the help, I've been having this issue for a long 
time but now it's the first time I feel I'm making some progress in 
figuring out what's going on.



On Thursday, March 22, 2018 at 8:04:10 PM UTC+2, Jesse Glick wrote:
>
> On Wed, Mar 21, 2018 at 5:33 PM, Daniel Anechitoaie 
> <[email protected] <javascript:>> 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(); 
>                  } 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/8ad400c2-03be-402e-8ac1-1545559fce40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to